[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PDFPIC issues
From: |
Deri |
Subject: |
Re: PDFPIC issues |
Date: |
Sun, 25 Aug 2024 19:59:12 +0100 |
On Friday, 23 August 2024 01:32:39 BST Deri wrote:
> The
> difference is that version 7 returns this layer as all 255, and version 6.9
> returns it as all zeroes. Which means that although the png is embedded you
> still can't see it because the whole image is transparent!
>
> My investigation continues.
Hi Peter,
This is in fact documented as a change in v7:-
http://www.imagemagick.org/script/porting.php#alpha
"Alpha
We support alpha now, previously opacity. With alpha, a value of 0 means that
the pixel does not have any coverage information and is transparent; i.e.
there was no color contribution from any geometry because the geometry did not
overlap this pixel. A value of QuantumRange means that the pixel is opaque
because the geometry completely overlapped the pixel. As a consequence, in
version 7, the PixelInfo structure member alpha has replaced the previous
opacity member. Another consequence is the alpha part of an sRGB value in
hexadecimal notation is now reversed (e.g. #0000 is fully transparent)."
Now that I have ascertained that this change is "official" I have released a
change to gropdf which checks which version of ImageMagick is installed and
behaves accordingly. The second issue, identify not returning the MediaBox
correctly is a bit more hairy, so I have altered pdfpic.tmac so that pdfinfo
is run first.
So you should be able to run the new PDFPIC using ImageMagick 6.9 as well as
7.
You can get a few surprises if you run PDFPIC without at least one of width or
height. I have a pdf which has an 800x800 pixel jpeg embedded, it is a scan of
a kodak instamatic 126 colour slide, 1 inch square. Identify reports the jpeg
as 800x800, but if you run convert file.jpg file.pdf then identify (and
pdfinfo) report the image as 72x72, and when run the picture takes up just one
inch on the page. It has not really shrunk, convert has used meta-data in the
jpeg which tells it that the scan was 800dpi so the original image was 1 inch
square so it has set the pdf MediaBox to that size.
It is safest to specify the size you want the image to take on the page rather
than trying to create an image of the size you want, just take into account
the resolution of the device the pdf will be consumed and make sure the image
has sufficient pixels, 100 dpi should be fine viewing on most screens, but you
may need significantly more it the pdf is to be printed. When viewing high dpi
images on a screen it may appear a bit disappointing because some of the
detail may not show, i.e. a 300 dpi image on a 100 dpi screen - the viewer has
to sample 9 pixels to produce 1 screen pixel, and it is further complicated by
the scaling of the window manager.
Cheers
Deri