I have a simply batch script which is executed on the contents of a folder. It's meant to resize only images over 1k down to 1k.
mogrify.exe -resize 1024x1024^> c:\xxxxxx\xxxxx\*.tga
After mogrify runs the modified date changes for all the files even those that aren't resized. Is mogrify actually doing something to the files that aren't altered? It was useful for me to keep the modification dates of my files intact.
Mogrify modifying even unprocessed files
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Mogrify modifying even unprocessed files
I believe that IM will read the image and write it unprocessed. Thus the time stamp change.
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: Mogrify modifying even unprocessed files
You could use identify to determine if each image needs processing. Some examples:
Are you using a batch file in Windows? Then you could set up a batch command if. Remember that % needs to be escaped to %% in batch files.
An aside: Instead of using ^ to escape >, you can use quotes, so "1024x1024>". This is more readable, especially since ^ has meaning in IM geometry strings, and leaves you more compatible with other platforms (and readers).
Code: Select all
identify in.tga
identify -format "%wx%h" in.tga
identify -format "%[fx:w>1024||h>1024]" in.tga
An aside: Instead of using ^ to escape >, you can use quotes, so "1024x1024>". This is more readable, especially since ^ has meaning in IM geometry strings, and leaves you more compatible with other platforms (and readers).