ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 bad quality while converting

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
lorife Posted - Sep 01 2022 : 09:06:19
Hello,
I'm switching from another component to your and I'm having some problems with the quality of the image.
I am reading a TIF, splitting it, and then saving to PDF.
The PDF I receive is blurried compared to the other components and I would like to understand if I can change something.

In both cases I resize the image to 1280 and I change the colors to 256, no filters applied.

Just to test it, I also tried saving back to TIF instead than PDF to see what happens but still it's worse.

The most important parts of the code I use are these:

IEGlobalSettings().RegisterPlugIns([ iepiPDFium ]);
IEGlobalSettings().PdfViewerDefaults.DPI := 144;

iev_IN.Proc.Resample(1280,1000,0,1);
iev_IN.Proc.ConvertTo(256);

bmp := iev_IN.IEBitmap;
idx := iemv_OUT.AppendImage;
iemv_OUT.SetImage(idx, bmp);

iemv_OUT.MIO.Params[0].PDF_Compression  := TIOPDFCompression.ioPDF_JPEG;
iemv_OUT.MIO.Params[0].PDF_PaperSize    := TIOPDFPaperSize.iepA4;
iemv_OUT.MIO.Params[0].PDF_PaperLayout  := TIEPageLayout.ielPortrait;
iemv_OUT.MIO.Params[0].PDF_ImageOptions := [iepioShrinkOnly, iepioCentered];

iemv_OUT.MIO.Params[0].TIFF_Compression := TIOTIFFCompression.ioTIFF_JPEG;

iemv_OUT.MIO.DuplicateCompressionInfo();


then I save, in case of tif:

iemv_OUT.MIO.SaveToFile('c:\temp\a.tif', 0, true)


and in case of pdf:

iemv_OUT.MIO.SaveToFile('c:\temp\a.pdf', 0, true)


As there is some sensible data I'm sending you an email with the files.
Could you help me?
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Sep 02 2022 : 23:26:16
Hi

1. If you specify Resample( 1280, 1000, rfLanczos3, True ) then you are saying the maximum height is 1000pixels, but you want the maximum height to be 1280


2. They have also used a filter/algorithm, otherwise there would be missing rows in the image


3. There is probably no harm in using color reduction to reduce file size with gray scale images


4. PDFium cannot be used here, because ImageEn does not use it for Image->PDF output


5. You can use rfFastLinear or a WIC filter. If you review the speed timings you will see they are very fast:

http://www.imageen.com/help/TImageEnProc.Resample.html


6. Are you getting a larger file size than before? Are the image sizes the same? PDF or TIFF? Please forward me new comparison images.



Nigel
Xequte Software
www.imageen.com
lorife Posted - Sep 02 2022 : 03:13:43
Hello,
thank you for the answer.
I tried and it works, it's even better.

some more question:
1. it's true that i had set 1280x1000 but I had also set TRUE as the last parameter. Doesn't that take care of setting the correct size?
2. I might be wrong but the other components did not use any filter, is it possible that here I have to to achieve this result (which is better by the way)?
3. I tried without reducing colors and the file got 1Kb bigger, maybe it makes sense to use after all, on bigger files?
4. I did not use PDFium because it's not thread safe, also if I use that I cannot rotate the image when needed.
5. Is there a way to achieve a similar result with a faster filter? I have to process many tif and create many pdf
6. How is it possible that the other component creates a smaller file and (if nr.2 is true) without filters?
xequte Posted - Sep 01 2022 : 18:41:21
Hi

The main problem/difference is your resampling:

> iev_IN.Proc.Resample(1280,1000,0,1);

You have not specified a resample filter. This should be rfLanczos3 or something of similar quality:

http://www.imageen.com/help/TResampleFilter.html

Also, you have specified a maximum size of 1280x1000, but your other product's output is 1280 pixels high. If you are happy with 1280 in either dimension then use:

iev_IN.Proc.Resample( 1280, 1280, rfLanczos3, True );

http://www.imageen.com/help/TImageEnProc.Resample.html

That will give you the same output as your other image.


Other points:
- I'm not sure there is much value in reducing colors to 256 if you are using JPEG compression
- PDFium is not used when saving an image to PDF, native code is used for that




Nigel
Xequte Software
www.imageen.com