Page 1 of 1

Convert PDF to JPG with minimum side length

Posted: 2016-10-16T03:31:59-07:00
by fffranz
Hi,
thanks for that nice program.
Now I have an question: is ist possible to convert an PDF to an certain side length - wherein the other side changes proportionally.
Sometimes I have small PDF with VectorImages - now I want to convert them to jpg or gif with the smalest side 300 pix - the other side will change proportionally. It doesnt matter if the small side is vertically or horizontally. Untill now i could not find a way.
Thank you in advance for your advices.

Re: Convert PDF to JPG with minimum side length

Posted: 2016-10-16T03:59:38-07:00
by snibgo
Try this:

Code: Select all

-resize "300x300^"

Re: Convert PDF to JPG with minimum side length

Posted: 2016-10-16T04:07:22-07:00
by fffranz
Hi, the other side should resize porportionally - not in the same way. Like the PDF is 600 x 700 - the jpg should be 300 x 350 ...

Re: Convert PDF to JPG with minimum side length

Posted: 2016-10-16T04:14:07-07:00
by snibgo
Did you try my suggestion? Didn't it work?

Re: Convert PDF to JPG with minimum side length

Posted: 2016-10-16T05:05:44-07:00
by fffranz
Sorry, I have the" ^ "overlooked and thought that does not work. But: I tried it - and it works - GREAT - there is only one problem: the background of the JPG is now black instead of white! Before with 1: 1 conversion the background remained white.

Now i have an other problem with converting more than one file. I worte
for %%f in (*.pdf) do convert -resize "4000x4000^" "%%f".pdf "%%f".jpg
Unfortunatly it doesnt work - did i use a wrong term in Imagemagick?

Re: Convert PDF to JPG with minimum side length

Posted: 2016-10-16T05:26:46-07:00
by snibgo
I suspect your PDF background wasn't white, but transparent. Try "-background pink -layers flatten" after reading it. If the background is now pink, then that was the problem, and you should use white instead of pink.

"convert" should read the input, then process it, then write the output.
fffranz wrote:Unfortunatly it doesnt work ...
Give me a clue. What didn't work? What happened instead? Did you get an error message?

Re: Convert PDF to JPG with minimum side length

Posted: 2016-10-16T06:20:57-07:00
by fffranz
Hi Snibgo,
Thanks for your note - I try the same time. Best, the background would remain white.

Batch processing does not work. I have a For / Do loop to convert several different PDFs. They all have different sizes and I would like to have a minimum of 300 pixeln of all. In the window is always always: No such file or image ... I think I have a mistake in selecting the different files one after the other. Is %% f perhaps wrong?

Thank you for your suggestions.

Re: Convert PDF to JPG with minimum side length

Posted: 2016-10-16T06:25:13-07:00
by fffranz
-background pink -layers flatten doesnt change anything. But no, the JPG is white again, i did nothing ;-)

Re: Convert PDF to JPG with minimum side length

Posted: 2016-10-16T06:33:07-07:00
by snibgo
Ah, I've seen the problem.

You set %%f to the filename, eg abc.pdf. But then you use "%%f%".pdf, so this will be abc.pdf.pdf.

Re: Convert PDF to JPG with minimum side length

Posted: 2016-10-16T06:53:20-07:00
by fffranz
You are right, sorry, i have problems with using this tokens. Is there an simple command, to convert (not to overwrite - like in mogrify) all PDF-files in an folder?

Re: Convert PDF to JPG with minimum side length

Posted: 2016-10-16T07:11:43-07:00
by fffranz
mogrify -format jpg -resize "4000x4000^" *.pdf
This works now - and its simple enough for me. Thank you for your help!
Greetings from Berlin
Franz

Re: Convert PDF to JPG with minimum side length

Posted: 2016-10-16T07:46:39-07:00
by fffranz
Finaly i use this batch convertign PDF in JPG:

mogrify -format jpg -resize "300x300^" -colorspace CMYK -type truecolor -quality 100 -set units PixelsPerInch -density 300 *.pdf

No black Background and good quality

Re: Convert PDF to JPG with minimum side length

Posted: 2016-10-16T11:02:24-07:00
by fmw42
Why do you want to convert to CMYK colorspace? That seem odd to me.