Recent

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

schuler

  • Full Member
  • ***
  • Posts: 155
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) ?

Thaddy

  • Hero Member
  • *****
  • Posts: 9809
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

schuler

  • Full Member
  • ***
  • Posts: 155
Re: How to Resize TPicture?
« Reply #2 on: February 19, 2020, 04:37:15 pm »
@Thaddy,
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.