Recent

Author Topic: [SOLVED] ImageList editor  (Read 559 times)

petevick

  • Sr. Member
  • ****
  • Posts: 347
[SOLVED] ImageList editor
« on: March 11, 2023, 10:07:41 am »
I keep trying to use the Replace button in the ImageList editor, I click the button, select the replacement image, click Open, but the image in the ImageList does not get replaced  ::) am I missing something  %) The images are identical in size.
« Last Edit: March 11, 2023, 01:39:32 pm by petevick »
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Windows 10, Lazarus 3.2, FPC 3.2.2

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: ImageList editor
« Reply #1 on: March 11, 2023, 11:29:00 am »
Just checked v2.2.0 and v2.2.6, and for me the replaced image appears immediately. The image, however, is not replaced when it has a different size compared to ImageList.Width and ImageList.Height. But you're saying that the images are identical in size...

petevick

  • Sr. Member
  • ****
  • Posts: 347
Re: ImageList editor
« Reply #2 on: March 11, 2023, 11:51:00 am »
Just checked v2.2.0 and v2.2.6, and for me the replaced image appears immediately. The image, however, is not replaced when it has a different size compared to ImageList.Width and ImageList.Height. But you're saying that the images are identical in size...
I was just double checking and have found what the issue is. I have the image list resolution set to 20x20, but the images I added to the image list are all 256x256. If I rescale one to 20x20 then it will replace that. So for Replace to function the selected image has to be the same resolution that the image list is set to. That's rather annoying, but at least I now know what the issue is.
Thanks again for your reply wp.
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Windows 10, Lazarus 3.2, FPC 3.2.2

petevick

  • Sr. Member
  • ****
  • Posts: 347
Re: ImageList editor
« Reply #3 on: March 11, 2023, 11:55:02 am »
The annoying thing is, if I replace an image programmatically using...
Code: Pascal  [Select][+][-]
  1. ImageList.ReplaceMasked()
...that works just fine, thankfully  ::)
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Windows 10, Lazarus 3.2, FPC 3.2.2

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: ImageList editor
« Reply #4 on: March 11, 2023, 12:59:26 pm »
OK now I understand what you are doing...

The ImageList of Laz2.0+ is able to handle different images sizes (unlike Delphi). It scales an added image to the sizes defined by ImageList.Width/Height and by the resolutions set up by means of the button "New Resolution".

Suppose your imagelist has been set up to handle size 20x20 and 40x40.
  • When you click "Add..." and select an image of any size it is scaled to both 20x20 and 40x40.
  • When you click "Add more resolutions..." and select two images they will be assigned or rescaled to  the 20x20 and 40x40 versions depending on which size is closest.
  • When you click "Replace" and select one image it will replace the one which has the size of the selected image; if there is no match nothing will happen (like in your case).
  • When you click "Replace all resolutions" and select one image it will be rescaled to all resolutions and replace all these versions of this image. (In Laz/main, IIRC, you can even select multiple images in this step which will replace the closest ones.)
So, in order to replace a 20x20 image in your case (in which the imagelist knows only a single size, namely 20x20) click the button "Replace all resolutions" rather than "Replace" if you want to replace the current image by one which you only have at 256x256. It will be scaled down to 20x20, though. If you also want to have the 256x256 images in the imagelist you must tell the image list this size by clicking "New Resolution" and entering "256" (the width of the new size; the height is calculated automatically).

petevick

  • Sr. Member
  • ****
  • Posts: 347
Re: ImageList editor
« Reply #5 on: March 11, 2023, 01:12:27 pm »
Wow, I'll have to give that a shot then. I felt sure that I was not going to be able to replace. I'll try this later, I'm very grateful for your help wp   ;)
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Windows 10, Lazarus 3.2, FPC 3.2.2

petevick

  • Sr. Member
  • ****
  • Posts: 347
Re: ImageList editor
« Reply #6 on: March 11, 2023, 01:38:56 pm »
....So, in order to replace a 20x20 image in your case (in which the imagelist knows only a single size, namely 20x20) click the button "Replace all resolutions" rather than "Replace" if you want to replace the current image by one which you only have at 256x256. It will be scaled down to 20x20, though.....
This works perfectly, exactly what I was after, this will save me no end of time. Many thanks again for this wp  ;)
Pete Vickerstaff
Linux Mint 21.2 Cinnamon, Windows 10, Lazarus 3.2, FPC 3.2.2

 

TinyPortal © 2005-2018