Re: [Gimp-user] Extracting images from a PDF



On Tue, 2019-09-24 at 18:25 +0000, dep wrote:
said Liam R E Quin:

To be clear, don't open the PDF in GIMP, as this will re-sample the
image.

Could you elaborate a bit here? Specifically, the harm you see coming
from this?

If the PDF file contains a JPEG image that was encoded at 200dpi (say),
and you open the PDF in GIMP at 300dpi, GIMP will use a library to
render the PDF to a bitmap image at 300dpi, so that library will take
the 200dpi embedded image, render it to a bitmap, and then enlarge it
(artifacts of compression and all), probably using a simple linear or
cubic interpolation.

This means that every pixel in the image GIMP sees will be an average
of the actual pixel values around it in the original.

What you want to do is to extract the original 200dpi (in this example)
image and then have GIMP open that, not lose the quality by changing
the size first.

There's no easy way to know the resolution of the embedded images; in
some cases ImageMagick's "identify" command will list them, and e.g.
https://superuser.com/questions/193485/extract-images-in-pdf-without-affecting-the-resolution
links to a simple program to extract the actual JPEG images from PDF
without reencoding them -
https://www.perlmonks.org/?node_id=720495

If you just need to rotate them, you can then use e.g. jpegtran, which
is lossless.

Also note the free version of Acrobat also changes the sizes of the
images by resampling.

slave liam (ankh on IRC)

-- 
https://www.fromoldbooks.org/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]