Upgrade pdf version! Is it possible?

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: XnTriq, helmut, xnview

cday
XnThusiast
Posts: 3976
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Upgrade pdf version! Is it possible?

Post by cday »

XnTriq wrote:I believe that both of the following settings have to be activated to achieve similar/identical display of nc_lomonosov.pdf and adobe_lomonosov.pdf:
Acrobat User Guide (Viewing PDFs and viewing preferences → [url=http://helpx.adobe.com/acrobat/using/viewing-pdfs-viewing-preferences.html#main-pars_text_30]Rendering[/url]) wrote:
  • Smooth Line Art: Applies smoothing to remove abrupt angles in lines.
  • Smooth Images: Applies smoothing to minimize abrupt changes in images.
Update:

My copy of Acrobat already had those settings enabled, and image quality is *not* as good as when the original image is viewed in an image viewer...

I think the inference is that enhancement of the original PNG image, which is already very high quality, using a filter won't in itself improve the PDF image quality... :(

Possibly the paletted colour is being lost even when Adobe Acrobat (XI) is used to create the PDF, and quite possibly PDF files of images in general are not rendered to the standard possible in image viewers with 'high quality zoom' enabled??
cday
XnThusiast
Posts: 3976
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Upgrade pdf version! Is it possible?

Post by cday »

Here is the original PNG opened in XnView Classic, converted to 64 Gray scale, and saved as a PDF with ZIP compression...

Note that the quality opened in Adobe Acrobat looks better, and the file size is still only 64KB (60.08KiB), much smaller than the other PDF versions posted.

Can someone compare the quality with the earlier PDF versions?

It should be possible to obtain the same result using NConvert with the same operations.

[Edit: I see NConvert also supports Indexed colours, which might possibly be a better option.]
Xn_Classic_64_Gray_ZIP_lomonosov.pdf
(60.08 KiB) Downloaded 55 times
User avatar
XnTriq
Moderator & Librarian
Posts: 6336
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Upgrade pdf version! Is it possible?

Post by XnTriq »

I've updated my previous post and attached the losslessly extracted images for analysis.
Unfortunately I can't do any tests with Acrobat Reader because I'm using PDF-XChange Viewer.

BTW: As previously mentioned by our friend Peter2, “‘image extraction’ from PDF is not a conversion from PDF to Image. It uses only the images in the PDF - if there are some ...”
-oX- ([url=http://newsgroup.xnview.com/viewtopic.php?t=24771&p=99913#p99913]PDF Extraction of Images[/url]) wrote:that the reason i have test dozens of pfd-extraction-tools and i have found only PDF-Tools give me 1:1 extraction
Michael Rutter ([url=http://www.tcm.phy.cam.ac.uk/sw/jpeg.html]JPEG converters compared[/url]) wrote:JPEGs can be losslessly extracted from EPS and PDF documents by using psimages or pdfimages as appropriate. Two JPEGs are considered identical if their files are identical (maybe after processing with jpegtran -copy none -optimise to remove extra comments etc.). They are considered different if their quantisation tables differ. These are printed to stderr by djpeg -verbose -verbose img.jpg > /dev/null
User avatar
XnTriq
Moderator & Librarian
Posts: 6336
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Upgrade pdf version! Is it possible?

Post by XnTriq »

As it turns out, PDF/PostScript documents can have an “interpolate flag”:
[color=green]pdfimages.exe -list *lomonosov.pdf[/color] wrote:

Code: Select all

                                     | page | num | type  | width | height | color | comp | bpc | enc   | interp | object | ID | x-ppi | y-ppi |    size | ratio
-------------------------------------+------+-----+-------+-------+--------+-------+------+-----+-------+--------+--------+----+-------+-------+---------+------
                 adobe_lomonosov.pdf |    1 |   0 | image |   726 |   1115 | rgb   |    3 |   8 | jpeg  | yes    |      6 |  0 |    96 |    96 | 274'315 | 11.0%
-------------------------------------+------+-----+-------+-------+--------+-------+------+-----+-------+--------+--------+----+-------+-------+---------+------
                    nc_lomonosov.pdf |    1 |   0 | image |   726 |   1115 | index |    1 |   8 | image | no     |      9 |  0 |    72 |    72 | 310'731 | 38.0%
-------------------------------------+------+-----+-------+-------+--------+-------+------+-----+-------+--------+--------+----+-------+-------+---------+------
xn_classic_64_gray_zip_lomonosov.pdf |    1 |   0 | image |   726 |   1115 | gray  |    1 |   8 | image | no     |      9 |  0 |    72 |    72 |  61'523 |  7.4%
SysTutorials (Man Pages → [url=http://www.systutorials.com/docs/linux/man/1-pdfimages/]pdfimages[/url] → interp) wrote:"yes" if the interpolation is to be performed when scaling up the image
Stack Overflow ([url=http://www.stackoverflow.com/questions/20011515#20031285]How to remove anti-aliasing in PDF images?[/url]) wrote:There is /Interpolate true entry in image dictionary of OCR-ed version, and that's what causes 'anti-aliasing'. Whether that (and not JPEG2000 instead of JPEG compression) is a cause of slow-down, you check on large enough files.

To un-set this key, the best would be to turn it off while creating a file, and if that's not possible, to write and run a small program in suitable language.
[color=green]adobe_lomonosov.pdf[/color] wrote:<</Subtype/Image/BitsPerComponent 8/Width 726/Interpolate true/ColorSpace/DeviceRGB/Height 1115/Filter[/DCTDecode]/Type/XObject/Length 273470>>
pdfimages.exe -j adobe_lomonosov.pdf adobe_lomonosov
pdfimages.exe -j adobe_lomonosov.pdf adobe_lomonosov
nc_lomonosov.zip
pdfimages.exe -j nc_lomonosov.pdf nc_lomonosov
(97.88 KiB) Downloaded 45 times
xn_classic_64_gray_zip_lomonosov.zip
pdfimages.exe -j xn_classic_64_gray_zip_lomonosov.pdf xn_classic_64_gray_zip_lomonosov
(60.19 KiB) Downloaded 45 times
Post Reply