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
 Save to PDF and file size

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
Dany Posted - Jul 16 2018 : 15:43:35
Hello!

I am running this procedure before I to save to PDF and TIFF (to ensure the target to be not to big):

procedure TImgCollection.ResampleAll;
var
  i: integer;
begin
  for i := 0 to MView.ImageCount-1 do
  begin
    MView.MIO.Params[i].TIFF_Compression := ioTIFF_JPEG;
    MView.MIO.Params[i].PDF_Compression := ioPDF_LZW;
  end;
  MView.IEMBitmap.ResampleAll(900, 900, rfLanczos3, True, True); 
end;


The case is:

- I start a new component sessión, then I aquire from scanner a few images, and then I save to PDF.
- Then I save the same content to a TIFF.
- Then I do MView.Clear;
- Then I load the saved TIFF.
- Then I save to a new PDF.

Always the last saved PDF is 30% bigger than the first one.

Is there something I am missing?

Thank you!
6   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jul 23 2018 : 18:58:13
Here's a better explanation from my partner:

JPEG compression never produces the same image of source, because it is lossy compression.
Loading and saving in sequence N times, produces N different images. LZW produces different sizes because it compresses different images.
out1.tiff, out2.tiff, out3.... aren't the same image (try to compare them pixel by pixel).
The size increases due the artefacts introduced by jpeg compression: anyway the increment stops after a number of savings.
To avoid this effect it is necessary to avoid ioTIFF_JPEG saving the TIFFs, and use a lossless compression, for example ioTIFF_lZW even for the TIFF.

Nigel
Xequte Software
www.imageen.com
xequte Posted - Jul 19 2018 : 01:56:14
Yes, but is lossless (nice crisp documents). JPEG compression is really only good for photos.



Nigel
Xequte Software
www.imageen.com
Dany Posted - Jul 18 2018 : 08:21:54
Hi Nigel;

I found that, if I use:

ImgNavigate.MIO.Params[i].TIFF_Compression := ioTIFF_LZW;
ImgNavigate.MIO.Params[i].PDF_Compression := ioPDF_LZW;

Then the problem does not exist anymore. But ioTIFF_LZW is doing a little bigger TIFF than ioTIFF_JPEG.
xequte Posted - Jul 17 2018 : 23:24:46
Yes, the PDF files do get unexpectedly larger with subsequent saves using ioPDF_LZW. We'll investigate that.

Changing the compression types also resolves the issue. As your images are monochrome, ioTIFF_JPEG would not generally be used (because it is lossy and blurs the document). TIFF has specific compression algorithms for monochrome images.


Nigel
Xequte Software
www.imageen.com
Dany Posted - Jul 17 2018 : 08:08:40
Hi Nigel;

Yes! I always do ResampleAll before. I am sending you the example files by email.
xequte Posted - Jul 16 2018 : 20:13:39
Hi Dany

In both cases of saving the PDF did you call your ResampleAll method?

Are you able to reproduce the issue by loading a TIFF instead of acquiring? If so, please email me the TIFF.

Nigel
Xequte Software
www.imageen.com