0

I have hundreds of images in a folder of size 1920x~100,000. I need to cut out the middle 900p of every file leaving the height unaffected. how do I pass each file to this command? magick convert image.jpg -crop 900x+510+0 result.jpg

2 Answers2

1

Two options:

  1. use mogrify instead of convert to replace the image with the result
  2. Let IM deduce the output file from the input fil:
convert *.jpg -crop 900x+510+0 -set filename:base "%[basename]" "%[filename:base]-cropped.jpg"

(or use a similar idiom to target a different directory)

xenoid
  • 8,396
  • 3
  • 23
  • 49
0
@echo off
setlocal
md "destinationdirectory" 2>nul
pushd "sourcedirectory"
for %%e in (*.jpg) do magick convert "%%e" -crop 900x+510+0 "destinationdirectory\%%e"
popd

simply substitute your directory names for sourcedirectory and destinationdirectory - and they can't be the same directory.

Magoo
  • 77,302
  • 8
  • 62
  • 84