Recent

Author Topic: [SOLVED] TImageList with large resolutions  (Read 407 times)

Raul_ES

  • Full Member
  • ***
  • Posts: 174
  • My interests: Healthcare & Computers
    • My Linkedin Profile, you can add me to stay in contact.
[SOLVED] TImageList with large resolutions
« on: April 16, 2020, 02:35:08 pm »
Hello,

I am not really sure if I can do the following. I would like to create an imagelist with big files (i.e 640x480 pictures or whatever, not 16x16, 32x32...) to use them in a Timage:

Code: Pascal  [Select][+][-]
  1. loginForm.ImageList_Flags.GetBitmap(1,Image_caFlag.Picture.Bitmap);


This code works fine, but they are scaled down to 16x16 format and I want them to be stored in the ImageList with their original size.


thank you!
regards
« Last Edit: April 18, 2020, 10:59:19 pm by Raul_ES »
Pharmacy + Chemistry + Biology + Healthcare + Computing

If you have any interest or project related with these areas feel free to contact me!

lucamar

  • Hero Member
  • *****
  • Posts: 3021
Re: TImageList with large resolutions
« Reply #1 on: April 16, 2020, 03:12:48 pm »
You have to set the list's Height and Width to the required dimensions; otherwise it uses the default, which is 16x16, and the images are scaled down when loading to the image list.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.8/FPC 3.0.4 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

wp

  • Hero Member
  • *****
  • Posts: 7537
Re: TImageList with large resolutions
« Reply #2 on: April 16, 2020, 03:31:20 pm »
I want them to be stored in the ImageList with their original size.
This is not possible. Store the images as resources. It is a simple script to create a res file from a file list with LazRes (see the .bat or .sh files in the images folder of your Lazarus installation).
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

lucamar

  • Hero Member
  • *****
  • Posts: 3021
Re: TImageList with large resolutions
« Reply #3 on: April 16, 2020, 06:16:04 pm »
I want them to be stored in the ImageList with their original size.
This is not possible. Store the images as resources. [...]

Yes, it is possible if all the images have the same dimensions. You just have to set the proper Width and Height in the TImageList; I just (re)tested with a set of 640x480 images and it works as it should. Of course, if the images are of different dimensions they will be cropped/scaled/whatever to the list dimensions, depending on how you add them and how several other properties of the list are set.

In fact, this is how you set-up a "normal" list for, say, 64x64 icons or whatever.

Only drawback is that if you load the images at design-time you may end up with a huge .lfm; in my test (just a form and an ImgeList with eight 640x480 images) it grew to a quite respectable 21,8 Mib :)
« Last Edit: April 16, 2020, 06:20:20 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.8/FPC 3.0.4 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

wp

  • Hero Member
  • *****
  • Posts: 7537
Re: TImageList with large resolutions
« Reply #4 on: April 16, 2020, 06:27:07 pm »
I want them to be stored in the ImageList with their original size.
This is not possible. Store the images as resources. [...]

Yes, it is possible if all the images have the same dimensions.
Right. But I was understanding the "or whatever" of the first post as hint that image size will vary.
« Last Edit: April 16, 2020, 08:04:40 pm by wp »
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Raul_ES

  • Full Member
  • ***
  • Posts: 174
  • My interests: Healthcare & Computers
    • My Linkedin Profile, you can add me to stay in contact.
Re: TImageList with large resolutions
« Reply #5 on: April 18, 2020, 10:59:02 pm »
Thank you, it works perfectly now. I did not know that we have width & height properties for TImagelist.


regards,
Pharmacy + Chemistry + Biology + Healthcare + Computing

If you have any interest or project related with these areas feel free to contact me!

 

TinyPortal © 2005-2018