I was trying to magick identify *.tif on hundreds of images, and found that magick buffers all the images into ram first and it's very slow. Certainly this simple operation could be much faster. I recall something about setting the buffer size for magick, that might help as well. But I would call this a serious limitation. I was able to write a quick Python program to get the stats of every image and it matches the magick output, and was much faster.
Should I consider this a bug report? Or a feature request? Or is there something I can set?
I had the same problem with finding the mean of all images. Of course when it comes to median, magick can be excused because the simple way would need all images at once.
[Solved] Sequence processing consumes all RAM
[Solved] Sequence processing consumes all RAM
Last edited by jmac698 on 2016-09-28T17:27:38-07:00, edited 1 time in total.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Sequence processing consumes all RAM
Try "-ping" to prevent the images being stored when finding the dimensions.
The general solution is to execute one command per image, and put that command within a shell loop. For both bash and Windows BAT, the shell loop command is "for", but the syntax is different.
The general solution is to execute one command per image, and put that command within a shell loop. For both bash and Windows BAT, the shell loop command is "for", but the syntax is different.
snibgo's IM pages: im.snibgo.com
Re: Sequence processing consumes all RAM
ok, thanks for the tip, here is sample code to process in a loop, using the scripting in cmd.exe (windows)
Code: Select all
@ECHO OFF
rem for loops in a batch file, over filenames
rem this is required to do for loops (setting variables within the loop)
SETLOCAL ENABLEDELAYEDEXPANSION
rem for loop, for %%f in (set).
rem parameter checking
if "%1%"=="" (
call :display_usage
exit /b
)
if "%1%"=="/h" (
call :display_usage
exit /b
)
if /i "%1%"=="/?" (
call :display_usage
exit /b
)
FOR %%f IN (%1) DO (
magick identify %%f>%%f.txt
echo %%f
rem show how to change a variable
set /a y=y+1
rem if you output %y% it will never change
rem to use a changed var, need to have SETLOCAL ENABLEDELAYEDEXPANSION
)
echo !y! files processed.
rem end program here, erase used variables (useful in case we are called externally)
ENDLOCAL
exit /b
:display_usage
echo.
echo identify multiple files with imagemagick v7
echo Usage: identall filespec
echo where filespec specifies files such as *.tiff
echo example: identall *.jpg
exit /b