Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Imagemagic convert: How can we set a page "a4 Landscape"?

Imagemagic convert:
How can we set a page "a4 Landscape"?

image Files and Folder structure:
number of jpg files: 2400.
separated into 30 folders: 80 jpgs in each folder.
Mission: create a pdf file for each folder, containing 80 images.
jpg image: 1366 x 768. (landscape)

1st trial:

convert -page A4 *.jpg pharma_reproductive.pdf

this results in a landscape image on A4 portrait. (too much white space.)

2nd trial:

convert -page A4 -rotate 90 *.jpg pharma_reproductive.pdf

this results in a 90 degree rotated landscape image on A4 portrait.

I can use this after 90 degree rotate on Adobe Reader everytime. Given that there are 30 files and the number will increase, there should be a way.

I googled with no luck, and I read the manual of imagemagic but this geometry thing is too complicated... (No offence, but Personally I think it should be more simplified...)

Thank you in advance.

Sincerely,
Doctor

like image 432
doctor Avatar asked Apr 15 '17 01:04

doctor


1 Answers

I solved a similar problem (landscape US-Letter to portrait A4) by separating the size and rotation steps. For your problem, the solution could look like so:

convert -rotate 90 *.jpg rotate-%d.jpg
convert -page A4 rotate-%d.jpg rotate-%d.pdf  # -density 450
convert -rotate -90 rotate-%d.pdf %d.pdf

You may want to add parameters -density 450 and -auto-orient to get the result in a good looking way.

like image 61
jotrocken Avatar answered Sep 29 '22 04:09

jotrocken