LEADTOOLS Support
Imaging
Imaging SDK Questions
Converting and resizing images - how do I maintain quality?
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, March 1, 2006 1:27:03 PM(UTC)
Groups: Registered
Posts: 3
I am evaluating the LeadTools API v14. All I am looking to do is convert TIF's to PNG's and optionally resizing them.
I have it working no problem, but the resized image quality is poor. I am wondering how to improve it. Code as follows:
(I included the L_OCXADD.BAS supplied in the \include folder)
i = L_GetDefaultSaveFileOption(t_SaveOptions, SIZEOFSAVEFILEOPTION)
i = L_GetDefaultLoadFileOption(t_LoadOptions, SIZEOFLOADFILEOPTION)
i = L_FileInfo(str_Source, t_FileInfo, SIZEOFFileInfo, 0, t_LoadOptions)
i_Size = 33 'Resize to 33% of original
xResize = t_FileInfo.Width * (i_Size / 100)
yResize = t_FileInfo.Height * (i_Size / 100)
i = L_FileConvert(str_Source, str_Dest, FILE_PNG, xResize, yResize, 8, 0, t_LoadOptions, t_SaveOptions, t_FileInfo)
We are dealing with simple B&W fax TIF images. The 33% resized image is illegible. Are there options to do this with a higher quality?
I know it's possible. We evaluated ImageMagick and it was able to maintain quality using what they called the "resize" function. They had a "sample" function that was identical to "resize" (both converted and resized an image in a call), but produced the same poor quality I am seeing with the LEAD API code above. Do you have a "resize"?!
#2
Posted
:
Sunday, March 5, 2006 4:56:02 AM(UTC)
Groups: Manager, Tech Support
Posts: 367
Was thanked: 1 time(s) in 1 post(s)
The L_FileConvert function does not have a parameter to control the resizing algorithm. What you could do is the following:
1. Load the image at full size using L_LoadBitmap
2. Convert it to 8-bit grayscale using L_GrayScaleBitmap
3. Resize the image using the L_SizeBitmap function, passing SIZE_RESAMPLE (2) as the last parameter.
4. Save it as 8-bit PNG using the L_SaveBitmap function.
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
#3
Posted
:
Friday, March 10, 2006 9:36:11 AM(UTC)
Groups: Registered
Posts: 3
That did the trick!
Thank you so much for the tip!
LEADTOOLS Support
Imaging
Imaging SDK Questions
Converting and resizing images - how do I maintain quality?
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.