PXC_ScaleImage loss quality

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
docpro
User
Posts: 5
Joined: Fri Nov 24, 2006 7:22 pm

PXC_ScaleImage loss quality

Post by docpro »

Hi,

I have 1 bit per pixel TIFF 4 images, it's scan documents.

if I use the PXC_ScaleImage with a size lower than original image, the image create pixels around the words, like JPEG, and the PDF was bigger(230KB) than original TIFF(60KB). I think that PXC_ScaleImage promote the image to 24 bits and apply the JPEG algorithme.

Ret = PXC_ScaleImage(hpdf, hImg, w * 0.5, h * 0.5, True, ScaleImage_Bilinear),


Does exist any way to scale the images without loss quality ?

Thanks

Paulo
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: PXC_ScaleImage loss quality

Post by Lzcat - Tracker Supp »

Hi.
No, there is no way to downscale images without loosing quality, even in theory - because of the nature of scaling.

Regarding your situation - PXC_ScaleImage must convert the image to an 8 bit per channel representation in order to use bilinear scaling, so after scaling you may get 24 bit per pixel image, which by default will be compressed using the JPEG algorithm. To prevent such a situation you may do one of the following:

1. Use the ScaleImage_Linear method. The image will then be using 1 bit per pixel, but scaling quality will not be so good (in your case only one of of four pixels will remain in the image).

2. Use the ScaleImage_Bilinear method, but after a call to PXC_ReduceImageColors(hpdf, hImg, 2, True, True, 0). For some images this may give a bit better quality than scaling using Use ScaleImage_Linear method, but for others - worse.

3. Use the available Image-XChange functions to scale the image and convert it to a 1-bpp format. This will give you a bit more flexibility during image manipulation.

4. Use an OCR library (at the moment we do not provide OCR functionality) and generate a text-based PDf whenever possible. Not so big a deal for one page PDFs, but for ten or more pages the difference in size may be very significant.

5. Do not scale 1-bit images unless they are extremely large - pxclib40 can compress 1-bit images well enough to get reasonable file sizes.
HTH.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Post Reply