Author Topic: How to Resize TPicture?  (Read 227 times)


  • Full Member
  • ***
  • Posts: 162
How to Resize TPicture?
« on: February 18, 2020, 05:59:31 pm »
 :) Hello :)

I'm creating and loading a picture with:
Code: Pascal  [Select][+][-]
  1. LocalPicture := TPicture.Create;
  2. LocalPicture.LoadFromFile(FileName);

The file can be either a jpg or png.

I would like to ask: what is the right way to resize it? Should I use LocalPicture.Bitmap.SetSize(AWidth, AHeight) ?


  • Hero Member
  • *****
  • Posts: 10193
Re: How to Resize TPicture?
« Reply #1 on: February 18, 2020, 06:13:43 pm »
Stretchdraw? That is the obvious way. Note you would want to apply a dithering to obtain "sharp" images in extreme cases.
But stretchdraw is the way to start...
StretchDraw is a method of canvas.

btw, aside,: more updates?
« Last Edit: February 18, 2020, 06:18:28 pm by Thaddy »
I am more like donkey than shrek


  • Full Member
  • ***
  • Posts: 162
Re: How to Resize TPicture?
« Reply #2 on: February 19, 2020, 04:37:15 pm »
I feel so honored in getting a reply from you!

I'll give a try to your solution and post here if it works.

BTW, do you have any public repo with your own code? I presume that I'll find interesting code...

Anyway, I've been working with Tiny ImageNet 200 and Plant Leaf Disease data sets. So, soon, we'll have examples with these data sets.


TinyPortal © 2005-2018