How can I use ImageMagick's command line utils to crop several iamges so that I remove the watermark on the bottom of them?


I have a personal website for my family where I post our photos. A family member took several photos with the phone. Every photo has the following text on it: date, name of the phone's owner, model of the phone. I want to crop the photos to cut out this information before posting it online.

This information is at the bottom of the photo and occupies the same height in every photo, so I need to write a script like so:

watermarkheight=20 # just a an example
for photo in *.jpg; do
  dimensions=$(identify $photo | awk '{ print $3 }') # it will be like 600x400, width X height
  newheight=$(( height - watermarketheight ))
  # i need help with line below
  someCommandToCropTheHeight --width $width --height $height --file $photo

What I need to know is how to use commands like mogrify or convert to cut out the "watermark" from the photos.

Any help is appreciated

  • I would batch process with XnConvert, which is a free - but closed source application. It's not ideal, but it's free and effective.
    – KGIII
    Apr 15, 2021 at 2:55

1 Answer 1


You could use ImageMagick's -chop option combined with a -gravity setting to remove 20px from the bottom of each image.

To save the cropped images in a directory results, you could run:

mkdir -p results
for photo in *.jpg; do
  convert "$photo" -gravity South -chop 0x"$watermarkheight" ./results/"$photo"


  • Thank you very much, this worked Apr 20, 2021 at 19:51

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.