I am trying to convert a list of images (png
) to a single PDF using imagemagick
.
I've tried using convert *.png -size 375 output.pdf
, however the resulting PDF remains much wider than the source images.
How can I get the PDF to match the size of the images - which all have a width of 375px?
Update:
Another way to say this is:
How do I create a PDF with it's page size equal to the height of it's corresponding image?
Update:
To illustrate the problem:
Updated Answer
I created 3 new PNG files with sizes more similar to yours using:
convert -size 375x10000 gradient:red-cyan 1.png
convert -size 375x10000 gradient:blue-magenta 2.png
convert -size 375x10000 gradient:silver-gold 3.png
and put them together in a 3-page PDF like this:
convert [123].png a.pdf
And I get this, which looks correct to me. I can only think you need to update your ImageMagick version, and/or your ghostscript version.
[
][
]3
Original Answer
Not sure what the problem is, here is what I did and it seems to work fine:
# Synthesise 4 pages, each 375px wide
convert -size 375x800 xc:red 1.png
convert -size 375x800 xc:yellow 2.png
convert -size 375x800 xc:lime 3.png
convert -size 375x800 xc:blue 4.png
# Now assemble into a PDF
convert [1234].png output.pdf
# Check what we produced
identify -verbose output.pdf | more
Image: output.pdf
Format: PDF (Portable Document Format)
Mime type: application/pdf
Class: DirectClass
Geometry: 375x800+0+0
Resolution: 72x72
Print size: 5.20833x11.1111
Units: Undefined
Type: PaletteAlpha
Base type: TrueColorAlpha
...
...