actualauction

How to Combine Multiple Images Quickly

If you have ever started an eBay auction and wanted to add your large picture collection to it, you will quickly realize that you can only add up to 12 pictures.  While it is true pictures can be added to the body of the auction and linked to an alternate sources, that is extra work. As a work-a-round to the 12 picture limit, pictures can be combined together.  Originally, I used Windows GUI based applications to organize my photos and combine them, but after spending about 45 minutes to an hour sorting through 30+ pictures only to realize that I would have to repeat this process for additional auctions, I had to come up with a solution.  One, that will take 45 minutes to less than 5 seconds using CentOS Linux!

Below is what an eBay seller is presented while setting up an eBay auction.

ebay-add-picsIn this example, suppose you have 33 images that you freshly scanned onto your Windows box. Once scanned, I copied the whole lot over to the Linux box.

ls -1 scan*.jpg

The truncated result.

scan0186.jpg
...
scan0217.jpg
scan0218.jpg

I can go through all my iterations to get to this point, but I'll spare you the boring details. The prerequisites.

yum -y install ImageMagick

Also a script that I found and is listed in the source(s) below.  I was unable to incorporate the script called zeropad.sh into one script so I use base64 to decode into a new file a zeropad.sh. Not necessary, this could be a file added to the Linux box, but this is how I wanted this work.

Here are the goals of this script.

  • User define the variable, fbase to prefix your final pics.
  • Create the script, zeropad.sh to pad the number from 1 to 01, 2 to 02 through to 09 to better sort the pics.
  • Resize the pics into manageable sizes.
  • Combine the individual pics into groups of 3 horizontally aligned as used by the "-tile 3x1"
  • Create a montage of all the pictures for the main eBay pic.
  • Renumber the pics.
#!/bin/bash

fbase=ebaypics

##### contents of zeropad.sh ################
##!/bin/bash
##num=`expr match "$1" '[^0-9]*\([0-9]\+\).*'`
##paddednum=`printf "%02d" $num`
##echo ${1/$num/$paddednum}

base64 -d << EOF > zeropad.sh
IyEvYmluL2Jhc2gKbnVtPWBleHByIG1hdGNoICIkMSIgJ1teMC05XSpcKFswLTldXCtcKS4qJ2AK
cGFkZGVkbnVtPWBwcmludGYgIiUwMmQiICRudW1gCmVjaG8gJHsxLyRudW0vJHBhZGRlZG51bX0K
EOF

chmod +x zeropad.sh

#Resize all scans
for i in scan0*.jpg; do convert $i -resize 534 $(basename $i .jpg).jpg; done
#Combine 3 images into 1
montage scan0*.jpg -tile 3x1 -geometry +0+0 $fbase.jpg
#Creates a large montage
montage scan0*.jpg -tile 6x5 -geometry +0+0 $fbase-all.jpg
#run with zeropad
for i in $fbase-*.jpg;do mv $i `./zeropad.sh $i`; done
RESULTS

Here are three source pictures (scan0186.jpg,scan0187.jpg, and scan0188.jpg), already resized.  Using the script above, these images are combined into the one picture below.

scan0188 scan0186 scan0187

 

 

 

Below, is a combined image called, ebaypics-01.jpg, resized and ready to go.

dnt-gss-00

Hope that this helps someone else.

Here is a partial screenshot of an actual eBay auction, complete with the "master picture" and the groups of three.

actualauction

SOURCE(S)

http://stackoverflow.com/questions/5417979/batch-rename-sequential-files-by-padding-with-zeroes