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
 JPEG Conversion to PDF file size explodes

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
brandonbrown Posted - Feb 04 2021 : 12:31:38
Hi there all,

I read through other posts about version 8 and the alpha channel, tried that code, without success so far.

My basic need is I'm taking graphic image files coming in, TIFF, JPEG, and making them PDF files.

For JPEG, for instance, I have 1.7mb scanned form, color, and when I do the basics below, the file size is 23mb.

Code:
multi.ImageList.LoadImages(SOURCE & strFile)

' Test, save immediately as another JPEG
multi.ImageList.CopyTo(0, outputPDF.Image)

outputPDF.Image.SaveImage(SOURCE & "newjpg.jpg")
outputPDF.Image.Resample(outputPDF.Image.Width, outputPDF.Image.Height, HiComponents.IEvolution.IEResampleFilter.FastLinear)
'outputPDF.Image.IOParams.PDF_Compression = HiComponents.IEvolution.IOParams.PDFCompression.JPEG
outputPDF.Image.RemoveAlphaChannel()

outputPDF.Image.CreatePDFFile(SOURCE & "newPDF.PDF")
outputPDF.Image.SaveToPDF()
outputPDF.Image.ClosePDFFile()

I basically immediately save it as another JPEG, and the file size is essentially the same. When I save to PDF, it blows up.

I removed the alpha channel, tried the IOParams line, but when I did that, the file is not a valid PDF and is 1k.

I must be not doing or doing something incorrectly.

Thoughts?
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Feb 05 2021 : 20:48:20
Your code looks correct above for adding a JPEG to a PDF.

What are your values for PDF_PaperWidth and PDF_PaperHeight?

https://www.imageen.com/ievolutionhelp/html/fbfd7377-250c-1931-46a6-200761a30d21.htm
https://www.imageen.com/ievolutionhelp/html/5de0d52a-a96b-9c8b-b89c-75d61d75bbb2.htm

Nigel
Xequte Software
www.imageen.com
brandonbrown Posted - Feb 05 2021 : 14:37:52
No, it's color. Saving immediately to JPEG works as expected. Adding it to a PDF is when it blows up in size. Is there a sample of adding a JPEG to a PDF?
xequte Posted - Feb 04 2021 : 18:09:58
Hi

Is your image monochrome (IOParams.BitsPerSample and IOParams.SamplesPerPixel = 1)?

If so, and you specify compression as ioPDF_JPEG, it will be set to ioPDF_G3FAX2D.

Also, this line does not appear to be doing anything (resampling to same size):

outputPDF.Image.Resample(outputPDF.Image.Width, outputPDF.Image.Height, HiComponents.IEvolution.IEResampleFilter.FastLinear)

Nigel
Xequte Software
www.imageen.com