Page 1 of 2

Make images larger

Posted: 2013-06-25T00:24:46-07:00
by danield
Hello,

I need is to enlarge smaller images than 500x500 to 500x500 in a folder. If there are greater images in the folder than 500x500 to leave them as they are without any change.

If it is possible to keep the quality of the image during the enlargement to 500x500 will be great. I currently receive the code below where it is enlarging all the images in the folder smaller than 500x500 but if I already have images 1000x1000 it is also modifying them to 500x500.

find . -name \*.jpg -exec convert -size '500x500' {} -resize '<500x500' {} \;

Any suggestions?

Thanks!

Dan.

Re: Make images larger

Posted: 2013-06-25T06:20:04-07:00
by snibgo
You need "500x500<". See http://www.imagemagick.org/script/comma ... p#geometry

If either dimension is less than 500, it will be resized so the smaller dimension is 500.

If "<" is a special character in your language, you need to escape it. Eg for Windows:

Code: Select all

convert in.png -resize "500x500^<" out.png

Re: Make images larger

Posted: 2013-06-25T06:29:38-07:00
by danield
Hi,

Thank you for your reply. I need this commando for a bulk operation. I have around 1000 images in a folder, some are greater than 500 (I don't need to modify them) and other are smaller than 500 (those I need to modify to 500)

Any idea?

Dan.

Re: Make images larger

Posted: 2013-06-25T06:50:39-07:00
by snibgo

Code: Select all

mogrify -resize "500x500^<" *.jpg
Ensure you have a backup, in case it doesn't do what you want.

Re: Make images larger

Posted: 2013-06-26T01:32:38-07:00
by danield
Thank you but after I run the command mogrify -resize "500x500^<" *.jpg I receive the error below:

mogrify: invalid argument for option `500x500^<': -resize.

Please help :).

Thanks!

Re: Make images larger

Posted: 2013-06-26T06:30:45-07:00
by snibgo
What platform are you on? If not Windows, it will be slightly different, perhaps:

Code: Select all

mogrify -resize '500x500\<' *.jpg

Re: Make images larger

Posted: 2013-06-26T06:41:19-07:00
by danield
Still the same error with command: mogrify -resize '500x500\<' *.jpg

Re: Make images larger

Posted: 2013-06-26T07:00:08-07:00
by snibgo
What platform are you on? What version of IM?

Re: Make images larger

Posted: 2013-06-26T07:06:42-07:00
by danield
Linux. Don't know the version of IM but I installed it 2 weeks ago from cpanel. I'm able to use other simple IM commands

Re: Make images larger

Posted: 2013-06-26T07:30:13-07:00
by snibgo
"convert -version" will display the version number, something like "6.8.6-0 2013-06-15 Q16".

An example on http://www.imagemagick.org/script/comma ... p#geometry doesn't escape "<", so perhaps you don't need to. I don't use any version of Unix, so can't test the possibilities.

Re: Make images larger

Posted: 2013-06-26T08:16:54-07:00
by danield
I have version: 6.2.8 05/07/12 q16. This helps?

Re: Make images larger

Posted: 2013-06-26T08:30:15-07:00
by snibgo
v6.2.8 is old. Very old. Almost prehistoric. (The date on the line is of the compilation, but the source code is much older.) Perhaps the "<" option wasn't available then.

I suggest you upgrade.

Re: Make images larger

Posted: 2013-06-26T08:36:53-07:00
by danield
Thank you but I have no idea how to upgrade :(. I installed it from WHM.

Re: Make images larger

Posted: 2013-06-26T09:12:25-07:00
by snibgo
I suspect you need to install from source. See http://www.imagemagick.org/script/insta ... e.php#unix

Re: Make images larger

Posted: 2013-06-26T09:19:08-07:00
by glennrp
snibgo wrote:v6.2.8 is old. Very old. Almost prehistoric. (The date on the line is of the compilation, but the source code is much older.) Perhaps the "<" option wasn't available then.
The "<" has been around for much longer than that.

It doesn't need to be (shouldn't be) escaped when it's already inside quotes.