Page 2 of 2

Re: Convert section of PDF?

Posted: 2016-10-15T18:26:24-07:00
by GeeMack
pctechtv wrote:I'm thinking there must be an option to leave off the last part with the output directory and tell ImageMagick just to create the jpeg in the original file's directory. If so how is this done? Thanks
You can set an output file name which is made from the input file name. Using the same example command I used above, and adding a variable with "-set filename:f", then naming the output file with that variable, we end up with a command like this...

Code: Select all

magick -density 300 mypdf.pdf[0] -set filename:f "%[d]/%[t]" ^
    -crop %[w]x%[fx:w/16*9]+0+0 +repage -resize %[fx:resolution.x*8.5]x "%[filename:f].jpg"
That will create your output JPG with the same name as your input PDF, but with the ".jpg" extension, and in the same directory as the input file. If there's any possibility your file name might have spaces or odd characters, make sure you use quote marks around the "%[d]/%[t]" variable and the "%[filename:f].jpg" at the end.

Read more about how you can use those IM built-in variables at this LINK. That's why they call it ImageMagick. :o

Re: Convert section of PDF?

Posted: 2016-10-21T10:46:16-07:00
by pctechtv
This really is helpful. Thank You!