Is there any TXImage method for resizing JPG image according to the pixel aspect ratio without losing image quality. I had an image with width 2821 pixel and height 2620 pixel and I need to resize it into 640*400 pixel
Regards
Sanil
Is there any TXImage method for resizing JPG image according to the pixel aspect ratio without losing image quality. I had an image with width 2821 pixel and height 2620 pixel and I need to resize it into 640*400 pixel
Regards
Sanil
oImage := GdiBmp():New( "file1.jpg" )
oImage:Resize( nWidth, nHeight )
oImage:Save( "newfile.jpg", nQuality )
oImage:End()nageswaragunupudi wrote:If you want to resize a jpeg image and save it, you may try GdiBmp class instead. Here is a sample you may try:
oImage := GdiBmp():New( "file1.jpg" ) oImage:Resize( nWidth, nHeight ) oImage:Save( "newfile.jpg", nQuality ) oImage:End()
Please also note that you never need to resize any images if the purpose is only to display in any control of FWH
XImage's zoom method retains aspect ratio. Actually there is no way of resizing an image without retaining aspect ratio. But ximage is not for saving images. (Note: we will be providing save method in coming versions)
In the existing methods you can retain the aspect ratio by your calculating the new width and height retaining the aspect ratio.
Following functions/methods automatically resize retaining the aspect ratio.
ResizeBitmap( hBitmap, nWidth, nHeight ) --> hNewResizedBitmap
You provide either width or height and leave the other as nil. Result is a resized bitmap retaining the aspect ratio.
In the above example you can use oImg:Resize( nWidth ). The method calculates the height retaining the aspect ratio,
Note: oImg:Resize( nil, nHeight ) also should work similarly but there is a bug in the method.
nageswaragunupudi wrote:
Following functions/methods automatically resize retaining the aspect ratio.
ResizeBitmap( hBitmap, nWidth, nHeight ) --> hNewResizedBitmap
You provide either width or height and leave the other as nil. Result is a resized bitmap retaining the aspect ratio.
In the above example you can use oImg:Resize( nWidth ). The method calculates the height retaining the aspect ratio,
Note: oImg:Resize( nil, nHeight ) also should work similarly but there is a bug in the method.