Page 1 of 1
Resize a picture
Posted: Friday 25th November 2022 2:58pm
by cogier
Can anybody tell me how to resize a picture without using a Shell command?
Shell "convert pict.png -resize 100x100 /tmp/pict.png" Wait
Re: Resize a picture
Posted: Friday 25th November 2022 3:11pm
by PJBlack
picturebox with stretch = true ???
otherwise ... the image class has a function called stretch
Re: Resize a picture
Posted: Friday 25th November 2022 4:19pm
by cogier
I am aware of 'Stretch'. Much better to use
Mode than stretch.
What I am doing gets a picture to line up with a GridView when being dragged. Below you can see it works. This allows me to resize the form and the image still lines up, so it needs to be exact. So sorry, 'Stretch' doesn't cut it!
Re: Resize a picture
Posted: Friday 25th November 2022 9:45pm
by Cedron
Does this "stretch" work for you? It seems to do what your shell command intends. (I just noticed PJBlack's second line, so here is an example.)
Ced
'=============================================================================
Public Sub Main()
Dim P As Image = Image.Load("~/Pictures/Wallpaper1920/DogOnDock.JPG")
Dim I As Image = P.Stretch(200, 200)
I.Save("DoD.jpg")
End
'=============================================================================
Re: Resize a picture
Posted: Saturday 26th November 2022 3:26am
by BruceSteers
cogier wrote: ↑Friday 25th November 2022 2:58pm
Can anybody tell me how to resize a picture without using a Shell command?
Shell "convert pict.png -resize 100x100 /tmp/pict.png" Wait
Image.Stretch
Dim hPic as Picture = Picture.Load(sMyPic) ' original size
Dim hPicStretched As Picture = hPic.Image.Stretch(100,100).Picture ' resized picture
Re: Resize a picture
Posted: Saturday 26th November 2022 10:00am
by cogier
Opps, sorry PJBlack. You were right, as is everybody else as well. It works like a charm.
Reminder, I must read posts more carefully!