AlexNovak wrote:How can I add image dimention into it's filename?
This line in a Windows BAT file would take every JPG in the directory and rename it to its original file name, followed by an underscore, followed by WxH, and ending with ".jpg"...
Code: Select all
convert *.jpg -set filename:f "%%t_%%wx%%h" -quality 100 "%%[filename:f].jpg"
That'll make, for example, "mississippi.jpg" into "mississippi_720x480.jpg", "illinois.jpg" into "illinois_480x720.jpg", etc.
Keep in mind that it does a conversion. Even with "-quality 100" you're going to change the input JPGs a tiny bit, so if you only want to rename the files, you'll probably have to work the output of the "identify" command into a loop based on what snibgo described above.
Also, if you run the command a second time in the same directory, each of those new output JPGs will get processed again. You might want to send the results of your command to a new directory to get them away from the originals. Create the output directory in your batch file and add it to the command something like this...
Code: Select all
convert *.jpg -set filename:f "donefiles/%%t_%%wx%%h" -quality 100 "%%[filename:f].jpg"
Use only single percent signs "%" if you're doing it from the command line.
EDITED TO ADD: If you are just renaming, it may even be more efficient to use another tool altogether. There are probably several Windows utilities that can do the job. One I'm familiar with that seems to work especially well for bulk renaming is IrfanView
. It allows you to insert variables like width and height, file size, resolution, various pieces of EXIF information, etc. into a naming template, then run it on individual files or entire directories.