Adrien Lemaire
Adrien Lemaire

Reputation: 1894

How to properly generate an A3 sized pdf from jpg with convert

On linux using the imagemagick tool convert, I want to convert my large jpg files into A3 pdfs <= 10MB in order to print those files with the best quality at the store.

When running:

$ convert summer-bokeh.jpg -quality 100 -density 300 -resize 2480x3508! summer_resized.pdf

I'm trying to force the A3 pixel size for 300 dpi, but the resulting pdf has a size of 595x842. If I try specifying the -page A3 option, the resulting pdf is even smaller, with a size of 202x286.

Note that this problem only occur with pdf. If I try the same convert command, with output file "summer_resized.jpg", the resulting image is correctly resized. Unfortunately, the store's printer only support pdfs.

Any idea how to fix that ? And on bonus question, is there a way to specify the max-filesize expected (here <= 10MB) ?

Thank you

Upvotes: 1

Views: 3737

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 207485

A3 is 11.69" x 16.53", so at 300 dpi, you need 3507x4959 pixels. So, if you do this:

convert -quality 100% input.jpg -resize 3507x4959 output.pdf

you will get this:

identify -verbose output.pdf
Image: output.pdf
  Format: PDF (Portable Document Format)
  Mime type: application/pdf
  Class: DirectClass
  Geometry: 3507x4959+0+0
  Resolution: 72x72
  Print size: 48.7083x68.875
  Units: Undefined
  Type: TrueColorAlpha
  Endianess: Undefined
  Colorspace: sRGB
  ...

and it weighs in at 5MB. I think the printer will ignore the resolution of 72 dpi.

Upvotes: 1

Related Questions