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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Tiff image squished in pdf
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

ioan

USA
15 Posts

Posted - Nov 02 2020 :  14:41:56  Show Profile  Reply
I'm trying to make a pdf from tiff images, but the images in the pdf are squished. If I use the same tiff in imagemagick, the pdf appears fine, but the one I create with imageen is squished. Is there anything I'm doing wrong? Here is my code I'm using to create the pdf:


    tiff := TIEMultiBitmap.Create;
    try
      tiff.ParamsEnabled := True;
      tiff.Read(TiffFileName, nil, true);
      tiff.Params[0].TIFF_Compression := ioTIFF_JPEG;
      tiff.Params[0].PDF_Compression := ioPDF_JPEG;
      tiff.DuplicateCompressionInfo;
      tiff.Write(PDFFileName, ioPDF);
    finally
      tiff.Free;
    end;


Please see the attached zip for the tiff file and the example pdf

attach/ioan/2020112144027_tiff-example.zip
34.79 KB

xequte

38203 Posts

Posted - Nov 02 2020 :  16:10:13  Show Profile  Reply
Hi Ioan

The horz. DPI is 204, whereas the vert. DPI is 98.

Setting them both to the same value should resolve the issue.

https://www.imageen.com/help/TIOParams.DpiX.html
https://www.imageen.com/help/TIOParams.DpiY.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

ioan

USA
15 Posts

Posted - Nov 02 2020 :  17:07:49  Show Profile  Reply
Hi Nigel,

Setting the DpiX and DpiY the same value doesn't seem to fix the problem.
Here is how the tiff looks like in infranview and how the pdf comes out, doesn't matter what DPI values I use.




I also attached the original tiff file here:





attach/ioan/202011217859_771B8EA2E18E4E949E613AA7A13BD0CD.zip
14.34 KB
Go to Top of Page

xequte

38203 Posts

Posted - Nov 02 2020 :  22:34:17  Show Profile  Reply
Sorry, you'll also need to scale the image to correct the unequal DPI.

With TImageEnMIO you can do this automatically using:

https://www.imageen.com/help/TImageEnMIO.AutoAdjustDPI.html


You can email me for a source update that allows you to easily do this with TIEMultiBitmap too.

// load a TIFF, fix the DPI and save it
IEGlobalSettings().AutoAdjustDPI := True;
mbmp := TIEMultiBitmap.create;
mbmp.Read('input.tiff');
mbmp.Write('output.tiff');
mbmp.free;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

ioan

USA
15 Posts

Posted - Nov 03 2020 :  12:32:08  Show Profile  Reply
Yes, TImageEnMIO with AutoAdjustDPI solves the problem.

I also sent you an email for the updated source to use TIEMultiBitmap.

Again, thank you for your help!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: