Help with resize and ">" option

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?".
Post Reply
Skinjob

Help with resize and ">" option

Post by Skinjob »

I thought the ">" option on the resize command should cause the image to be resized only if one of the dimensions exceeds the geometry spec. However, it seems that the image is always changed or at least rewritten as the file date/time stamp is always updated even if the geometry does not exceed the spec.

For example:
mogrify -resize "200x200>" folder.jpg

Initially folder.jpg is 300x300
After above command is run, size is 200x200
If above command is run again, size is still 200x200, but folder.jpg file date/time stamp is updated.

Am I not understanding how ">" is intended to work? Or am I just not using it correctly?

I'm trying to use this resize album art on my MP3 player. Most album art in my library is around 500x500. I'd like to be able to sync the player and then run a batch file that will resize any larger images down to 200x200. Any images already 200x200 or less should be left alone. Is this possible with ImageMagick?

I'm using the 6.4.1-3-Q16-windows-dll version on Windows XP SP2.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Help with resize and ">" option

Post by Bonzo »

From a previous post it has been noticed the image is read in to check the image dimensions and it is only resized if the criteria are met but it is saved no matter what. This means the image is not changed but the date is modified.
If you do not want this to happen you need to check if the image needs resizing using some other method first.
Skinjob

Re: Help with resize and ">" option

Post by Skinjob »

Bonzo wrote:From a previous post it has been noticed the image is read in to check the image dimensions and it is only resized if the criteria are met but it is saved no matter what. This means the image is not changed but the date is modified.
If you do not want this to happen you need to check if the image needs resizing using some other method first.
Ah rats. I guess it's not the end of the world, just means my batch process is going to take longer. Thanks for the reply.

I didn't see the previous post you mentioned. I just searched again in the bug forum and didn't see anything. Has this been reported as a bug already or should I post it in the bug forum?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Help with resize and ">" option

Post by Bonzo »

I can not remember the post either; it was only in the last month or so and it came up under a different thread title - the problem was not in the title thats why you didn't see it.

From what I remember the result was the same as I told you - That you have to check the image before reading it in.
Skinjob

Re: Help with resize and ">" option

Post by Skinjob »

Thanks again. I guess I'll post in the bug forum and see what happens. Again, it's not a huge deal, but it certainly doesn't seem like the expected behavior.
Post Reply