1

Imagine I have a bunch of JPEG files that I have scanned using a known resolution (300 dpi in this case). However the JPEG file has some additional margin at the border because the scanner's area is larger than the A4 paper.

The resulting PDF should have the same geometry as the original paper was: Din A4 (210mm x 297mm).

A possible compression would be necessary as well...

Just an idea was the following (not working). You might ignore this and post a command that fulfils my needs which is suitable for my aim

convert                    \
   Scan_20181221205531.jpg \
  -units PixelsPerInch     \
  -density 300             \
  -format pdf              \
  -compress jpeg           \
  -quality 70              \
  -page a4                 \
   out.pdf
convert: not authorized `out.pdf' @ error/constitute.c/WriteImage/1028.
  • 2
    This answer might explain the "not authorized" error: stackoverflow.com/a/52717932 – Stephen Harris Dec 23 '18 at 19:11
  • I prematurely gave a totally wrong answer, which I deleted again. @StephenHarris seems to be spot-on with his hint. You may have to check your policy.xml file and modify it to give your ImageMagick permissions to write PDF files. – Kurt Pfeifle Dec 23 '18 at 19:49
  • The issue is NOT the "not authorized" error because other commands work as well. So this command I proposed is somehow (syntactically) malformed. I am just asking for a suitable command for my specific problem. You might even ignore my suggested command since it does not work anyway – camel-active Dec 23 '18 at 20:44
-1

use "crop" and look here https://unix.stackexchange.com/a/20057 btw the dpi just sets an attribute in the pdf

http://www.imagemagick.org/Usage/crop

https://imagemagick.org/script/command-line-options.php#crop

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.