I have a folder of images over 4MB
- let's call this folder dsc_big/
. I'd like to use convert -define jpeg:extent=2MB
to convert them to under 2MB
and copy dsc_big/*
to a folder dsc_small/
that already exists.
I tried convert dsc_big/* -define jpeg:extent=2MB dsc_small/
but that produces images called -0
, -1
, and so on.
What do I do?
This was the command which helped me after a long try. I wanted to make same sized thumbnails from a big list of large images which have variable width and height . It was for creating a gallery page.
I got re-sized thumbnails which all having same width and height. :) thanks to ImageMagick.
Here's a solution without using for loops on the console
convert
is designed to handle a single input file as far as I can tell, although I have to admit I don't understand the output you're getting. mogrify is better suited for batch processing in the following style:But honestly I consider it dangerous for general usage (it'll overwrite the original images if you forget that
-path
) so I always useconvert
coupled with a for loop for this:The
basename
call isn't necessary if you're processing files in the current directory.Although this is an old question, but I'm adding this response for the benefit of anyone else that stumbles upon this.
I had the same exact issue, and being discouraged by the use of
mogrify
, I wrote a small Python based utility called easymagick to make this process easier while internally using theconvert
command.Please note, this is still a work in progress. I'll appreciate any kind of feedback I can get.
I found that
cd
-ing into the desired folder, and then using the bash global variable$PWD
made myconvert
not throw any errors. I'm utilizing ImageMagick's recently implementedcaption:
http://www.imagemagick.org/Usage/text/#caption function to label my images with the base filename and place them in another directory within the first.This works for me
produces image-0.jpg, image-1.jpg, image-2.jpg ..... in the 'rotate' folder. Don't know of a way to preserve the original filenames though.