On Tue, 6 Jan 2015, Chris Green wrote:
On Tue, Jan 06, 2015 at 01:48:23PM +0000, James Freer wrote:
On Tue, 6 Jan 2015, Steve Engledow wrote:
On 05/01, Chris Green wrote:
Is there any simple, automated way I can shrink the pictures? I don't want to have to specify a size for every one of them, I just want to shrink them to a 'reasonable' size.
I can fairly easily add a command (or two) to my script that does the copy, e.g. an ImageMagick 'convert' but how to set the amount of shrinkage?
It depends what you're after.
You can resize by percentage:
convert in.jpg -resize 50% out.jpg
You can resize to a particular size but only if the image is larger than that already:
convert in.jpg -resize 800x600> out.jpg
Or you can resize so that the image has a certain area in pixels:
convert in.jpg -resize 480000@ out.jpg
This is a [handy link](http://www.imagemagick.org/Usage/resize/).
Steve
Imagemagick I have found excellent as the quickest for batch resizing and watermark. I don't use convert though - I use mogrify. Perhaps convert does them as pixel size... haven't got the book handy to check.
# batch resize mogrify -resize 50% *.jpg
#date watermark mogrify -font /usr/share/fonts/truetype/msttcorefonts/Arial.ttf \ -pointsize 20 -gravity southeast \ -fill black -annotate +10+10 '04May2014' \ -fill white -annotate +11+11 '04May2014' \ *.jpg
Part of the question was really about what size I should resize them to!
OK, so Imagemagick seems to be the tool of choice. How do I decide what size to make the JPGs? I don't want to have to individually decide for each picture, most will start as 3264x2448 but I can't guarantee that they're all that size. So, say I decided that a maximum dimension of 1024 pixels made sense how do I automate converting a random collection of JPG images to <=1024 in either direction?
-- Chris Green
At a quick glance you need to use the -resize -filter and -sample options and that'll give you what you require to retain aspect ratio. Join the IM forum they are a helpful bunch. IM is a very powerful app and takes some learning.
My pics are 1600 x 800 and I mogrify to 700 x 525 for forums... 1024 x 768 for my desktop dog pics. I wanted to do bulk resizing and watermarking quickly and that was as far as I went.
james