[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ale] batch image resizing

yep, it's me again.  i have been using a "comic book reader" style for
my zipped jpgs and now i want to resize the images in the zip files to a
smaller resolution.

if you are not familiar with cbr (or cbz) files, they are just zipped
(cbz) or rar'ed (cbr) files of images with the extension changed so they
open with Comix (for Linux) or CDisplay (Windows).  I have come to use
this style for pictures that I send to family and friends.  this way
they don't have to unzip the file and then go to the directory and then
open their image viewer to see them.  all they have to do is double
click on the cbr (or cbz) file and the viewer starts up for them to page
through the images.  this has made things much simpler for me when
dealing with certain people.

since i have several years worth of zipped files, i was hoping to do the
following (possibly) with a shell script:

1) rename the file (which probably has spaces in the name) to either zip
or rar (depending on cbZ or cbR extension)
2) unzip/unrar the file
3) resize all files in the created directory so that their height is
1280px (keeping the ratio.  don't care how wide the images turn out to
be just want the height to be "Whatever x 1280")
4) zip the files back up
5) rename to cbz extension (since i think it will be easier to zip than rar)
6) delete the created directory and start on the next file

i am hoping that i will be able to lessen the file sizes by almost half
without losing much of the clarity in the pictures (car shows,
motorcycle shows, birthday parties, etc) by doing all this.

i have found a command in the ImageMagick suite called "mogrify" which i
think might fit my needs, although i am unsure of how to keep the width
"open" so that my ratio's don't get whacked.  some of these pictures
have been oddly cropped so they are "taller" than "wide"

so while i am researching the 'net, i thought maybe someone might have
done something similar to this already.  i really don't want to have to
manually go through all these gigs worth of pictures in my spare time.

as always, any suggestions are appreciated.