Make images larger

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
danield
Posts: 12
Joined: 2013-06-25T00:16:00-07:00
Authentication code: 6789

Make images larger

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Make images larger

Post 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
snibgo's IM pages: im.snibgo.com
danield
Posts: 12
Joined: 2013-06-25T00:16:00-07:00
Authentication code: 6789

Re: Make images larger

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Make images larger

Post by snibgo »

Code: Select all

mogrify -resize "500x500^<" *.jpg
Ensure you have a backup, in case it doesn't do what you want.
snibgo's IM pages: im.snibgo.com
danield
Posts: 12
Joined: 2013-06-25T00:16:00-07:00
Authentication code: 6789

Re: Make images larger

Post 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!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Make images larger

Post by snibgo »

What platform are you on? If not Windows, it will be slightly different, perhaps:

Code: Select all

mogrify -resize '500x500\<' *.jpg
snibgo's IM pages: im.snibgo.com
danield
Posts: 12
Joined: 2013-06-25T00:16:00-07:00
Authentication code: 6789

Re: Make images larger

Post by danield »

Still the same error with command: mogrify -resize '500x500\<' *.jpg
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Make images larger

Post by snibgo »

What platform are you on? What version of IM?
snibgo's IM pages: im.snibgo.com
danield
Posts: 12
Joined: 2013-06-25T00:16:00-07:00
Authentication code: 6789

Re: Make images larger

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Make images larger

Post 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.
snibgo's IM pages: im.snibgo.com
danield
Posts: 12
Joined: 2013-06-25T00:16:00-07:00
Authentication code: 6789

Re: Make images larger

Post by danield »

I have version: 6.2.8 05/07/12 q16. This helps?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Make images larger

Post 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.
snibgo's IM pages: im.snibgo.com
danield
Posts: 12
Joined: 2013-06-25T00:16:00-07:00
Authentication code: 6789

Re: Make images larger

Post by danield »

Thank you but I have no idea how to upgrade :(. I installed it from WHM.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Make images larger

Post by snibgo »

I suspect you need to install from source. See http://www.imagemagick.org/script/insta ... e.php#unix
snibgo's IM pages: im.snibgo.com
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Make images larger

Post 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.
Post Reply