5

I want to shift from imagemagick to graphicsmagick

But I encounter some issues with the syntax

With imagemagick

First I need to merge some images into a PDF

convert -density 300 page_*.tif output.pdf

And then I need to create a thumbnail of the first page of the PDF

convert -density 300 file.pdf[0] -background white -alpha remove -resize 140x140 -strip -quality 40 thumb.jpg[0]

This works fine.. But I want to switch the first command to graphicsmagick

Width graphicsmagick/imagemagick

The graphicsmagick syntax here works fine

gm convert -density 300 page_*.tif output.pdf

But when creating the thumbnail with imagemagick the output has the right size but the acutal image is downsized inside the image itself?!

Thumbnail with imagemagick

enter image description here https://secure.dyndev.dk/data/voucher/30000/400/30435_eb7e5d0a9df71b2783e2fa89efd9de12fcdb9679.pdf

Thumbnail with graphicsmagick

enter image description here https://secure.dyndev.dk/data/voucher/30000/400/30433_7710d6404534b0868ab8da41dd651e971b70e16b.pdf

Community
  • 1
  • 1
clarkk
  • 27,151
  • 72
  • 200
  • 340
  • That's likely what a 140x140 image looks like at 300dpi in your output PDF. Can graphicsmagick take a size argument for the resulting file? That may be worth looking into – Pekka Nov 26 '15 at 18:30
  • Compare the two thumnails.. There is a significant difference.. The graphics version is downsized inside the image itself – clarkk Nov 26 '15 at 18:32
  • What size is the resulting PDF in each case? (Physical dimensions) – Pekka Nov 26 '15 at 18:32
  • have added a link to each pdf – clarkk Nov 26 '15 at 18:34
  • The PDFs look the same for me? And Acrobat says they are the same size – Pekka Nov 26 '15 at 18:35

1 Answers1

4

Just hit the same issue, and found a solution here: https://blog.josephscott.org/2009/11/16/imagemagick-convert-pdf-to-jpg-partial-image-size-problem/

You need to change your convert command into:

convert -density 300 -define "pdf:use-cropbox=true" file.pdf[0] -background white -alpha remove -resize 140x140 -strip -quality 40 thumb.jpg[0]

And perhaps add a -resize "2000x2000>" to limit the size of the resulting JPEG, especially with high density values.

Yvan
  • 2,539
  • 26
  • 28