-
ImageMagick version7.1.1-30 Operating system, version and so onWindows 10 DescriptionHello. I didn't find the answer here, but maybe I searched not well enough. My task is to get resolution (size, i.e. width and height in px) of many images located in different folders. I need this data for my scripted tool. By simply using scripting language I can run magick command line and also run .bat file, but I'm facing performance issues. To get image data I use "magick identify -ping". Files could be pretty large, could be located in different folders, those folders can contain other files that I don't need. Because of these reasons I need to specify a full file path (which is pretty long) for each file. I can't just use a long list of file paths in one command run because of chars limitation. This ends up with using loops, either in script itself or in bat file. This loop takes a lot more time to process in comparison to simple "magick identify -ping folder*.* >> output.log" command. The question is what other options I left? Maybe API could do the job by using some Python code or it won't help? Maybe I'm already missing something? Thanks for your time. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
What limitation? I assume a Windows limitation on command length. I suggest using a list of the files in a text file, and referring to that file with the
Then:
This shows results like:
For escapes %f etc, see https://imagemagick.org/script/escape.php. If doing this in a BAT script file, double each percent If we want the filename, width and height in environment variables, we can do this:
On my laptop, this takes about 0.4 seconds for 400 files. |
Beta Was this translation helpful? Give feedback.
What limitation? I assume a Windows limitation on command length.
I suggest using a list of the files in a text file, and referring to that file with the
@
notation. For example, using Windows, we make a file namedxlist.txt
containing one filename per line:Then:
This shows results like:
For escapes %f etc, see https://imagemagick.org/script/escape.php. If doing this in a BAT script file, double each percent
%%
.If we want the filename, width and…