3

I'm doing some batch image processing with imagemagick on OSX using this line:

for file in $(cat all.txt); do convert -crop 50X50@ +repage +adjoin "$file" "$file"_tile_50x50@_%d.jpeg; done

It takes a filelist as an input, chops each file into 50x50 pixel tiles, and labels the output with the original filename and an index number (%d). The quantity of imagery is about 400+ source images, and hence 1,000,000 output images.

I have to move the processing to a Windows 10 box. Can someone help me translate the above loop across, or suggest a better way to achieve the same outcome?

2

Oh well, answering my own question again; hoping someone else finds it useful! Using Windows Powershell, the below. Place the source images (jpeg image files in my example) in directory foo, the create the outputdir directory. Then execute this command:

dir -recurse -include *.jpeg | %{convert $._FullName -crop 50x50@ +repage +adjoin “C:\foo\bar\outputdir\$($_.Name)”}

Loads of thanks to the contributors on this Stack Overflow question for giving the right structure and keywords for me to solve the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.