Repeat a portrait eight times so it can be cut out from a 6″x4″ photo and used for visa or passport photos

Repeat a portrait eight times so it can be cut out from a 6″x4″ photo and used for visa or passport photos

1
montage 2007-08-25-3685.jpg +clone -clone 0-1 -clone 0-3 -geometry 500 -frame 5 output.jpg

Yes, You could do it in the GIMP or even use Inkscape to auto-align the clones, but the command line is so much easier.

NOTE: The +clone and -clone options are just to shorten the command line instead of typing the same filename eight times. It might also speed up the montage by only processing the image once, but I’m not sure. “+clone” duplicates the previous image, the following two “-clone”s duplicate the first two and then the first four images.

NOTE2: The -frame option is just so that I have some lines to cut along.

BUG: I haven’t bothered to calculate the exact geometry (width and height) of each image since that was not critical for the visa photos I need. If it matters for you, it should be easy enough to set using the -geometry flag near the end of the command. For example, if you have your DPI set to 600, you could use “-geometry 800×1200!” to make each subimage 1? x 2 inches. You may want to use ImageMagick‘s “-density 600” option to put a flag in the JPEG file cuing the printer that it is a 600 DPI image.

BUG2: ImageMagick does not autorotate images based on the EXIF information. Since the portrait photo was taken with the camera sideways, I made the JPEG rotate using jhead like so: jhead -autorot 2007-08-25-3685.jpg

* View this command to comment, vote or add to favourites * View all commands by hackerb9

commandlinefu.com

by David Winterbottom (codeinthehole.com)

URL: http://feedproxy.google.com/~r/Command-line-fu/~3/RxOm5plaH2M/repeat-a-portrait-eight-times-so-it-can-be-cut-out-from-a-6×4-photo-and-used-for-visa-or-passport-photos

Enhanced by Zemanta

About Amit Agarwal