Author |
Topic |
|
brandonbrown
USA
37 Posts |
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? |
|
xequte
38682 Posts |
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
|
|
|
brandonbrown
USA
37 Posts |
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
38682 Posts |
|
|
Topic |
|
|
|