Search code examples
delphidelphi-xe6

Proportional image size changing without quality decreasing in TImage


I have TImage 800x600 with image 1024x768. TImage aligns to alClient. Timage is proportional. TImage is streched.

When I resize the form, the image resizes too, but it's quality makes lower and the visible text labels on the Image shrinks, makes unreadable, or even after load big image into small TImage, I have the same problem.

How I can resolve that? How resize image in TImage with quality where text still readable in any normal size?(e.g. 1024x768 resized to 500x400, and text still readable in it).


Solution

  • TImage resizing is not perfect. I prefer to keep the original image in the memory, and to use, say, bicubic resizing when needed (or bilinear for shrinkink). Once you resized the image just draw it to the TImage on the form.

    Always keep the original image in the memory, and discard the resized one from the memory once you draw it.