Reputation: 27806
I am converting N PNG files to one pdf file. This works great with convert
from image magick:
convert front1.png back1.png front2.png back2.png result.pdf
Here is a simple ascii art to illustrate this:
+-------------------+ +-------------------+
| | | |
| | | |
| Front-1 | | Back-1 |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
+-------------------+ +-------------------+
+-------------------+ +-------------------+
| | | |
| | | |
| Front-2 | | Back-2 |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
+-------------------+ +-------------------+
Sometimes the back-side is missing, but I would like to keep the duplex information.
Case1: the first backside is missing:
convert front1.png front2.png back2.png result.pdf
If this gets printed on a duplex printer, then the result would be:
+-------------------+ +-------------------+
| | | |
| | | |
| Front-1 | | Front-2 |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
+-------------------+ +-------------------+
+-------------------+
| |
| |
| Back-2 |
| |
| |
| |
| |
| |
| |
| |
+-------------------+
One simple work-around would be to take an empty page if I don't get back1.png
. But this is just a work-around, which I would like to avoid.
How can I keep duplex information in the create PDF if back1.png is missing?
Upvotes: 0
Views: 39
Reputation: 53081
In Imagemagick you can add a new image where desired by putting a white or any other colored image in the place you want. If all the pages are the same or you want to match the right side pages size to that of the left as in your example, then do:
Unix syntax:
convert front1.png back1.png front2.png \( +clone -fill white -colorize 100 \) result.pdf
Windows syntax:
convert front1.png back1.png front2.png ( +clone -fill white -colorize 100 ) result.pdf
If using Imagemagick 7, then replace convert with magick.
Upvotes: 1