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?".
for %%f in (*.jpg) do (
convert %%f -crop 500x500 -set filename:tile "%%t_%%[fx:page.y/500+1]_%%[fx:page.x/500+1]" slices\%%[filename:tile].jpg
)
Simply put, the problem is that this script which previously worked brilliantly, now all of a sudden doesn't work ( on two different computers), but instead hangs the computer and slows it down to where it is barely usable.
I'm not sure whether it is related but the problems started after I tried to incorporate the above script in a .bat which creates the necessary subdirectories for all my image folders:
setlocal
set "location=D:\Reg\B\N1"
for /d %%d in ("%location%\*") do (
md "%%d\slices"
)
for %%f in (*.jpg) do (
convert %%f -crop 500x500 -set filename:tile "%%t_%%[fx:page.y/500+1]_%%[fx:page.x/500+1]" slices\%%[filename:tile].jpg
)
Did you install the legacy components so that you can use convert? Otherwise, you should replace convert with magick on IM 7. Sorry I do not use Windows, so cannot help further.
You have up to 600 M pixels. In Q16 v6, this will need 4.8 GB memory just to read the input file before cropping. (I'm not sure how much v7 uses.) As it "slows it down to where it is barely usable", I suspect you have run out of memory so it is using disk. How much RAM do you have? How much available RAM? Perhaps doing nothing else on the computer (eg running browsers) will solve the problem.
Just tried Q8, same thing. I have 16 GB on one computer and 8 GB on the other, both on which it worked great before. Indeed the memory usage seems to be maxed out, at least on one computer. It is still quite strange why a process that previously worked fine, would not work anymore.
I tried creating a new .bat file with just the conversion script, and it worked a few times, and a few times it didn't.
If someone has a better suggestion, I'm open to trying them. Basically I want a script that automatically detects any jpg:s in a directory, and crops & names them similar to what I have in my original script.
What do you get from convert -version? Does it have HDRI on? Does it include JPG delegates? I do not know windows, but have you watched/checked your TMP directory (where ever that is) where IM holds temp copies to see that it is not getting full and has enough space allocated?
1. Convert your large JPEG into a large MPC.
2. Make crops of that MPC. Each crop is the full width but only 500 pixels high.
3. From each crop, make your final crops.
I've found the reason behind the problem. The memory was indeed the issue, but mainly because I just used renamed .tif files (renamed .tif --> .jpg) to be able to run the script. I got the script from someone else with the instructions to use .jpg:s, hence the reason for renaming them. I did a batch conversion in irfanview and properly converted the .tif:s into .jpg:s instead of renaming them which resulted in the script running perfectly.
Although I must ask, shouldn't 16 GB RAM be enough to complete at least 1 image?