Search code examples
imageimagemagick

How to adjust -brightness-contrast of multiple JPG files using imagemagick?


I have ~500 JPG pictures like this:

enter image description here

it has a watermark on it.

I want to set these pictures to brightness=10 so that the watermark will vanish

enter image description here

I use imagemagick 7.1.1-18 on Archlinux

I tried magick ./*.jpg -brightness-contrast %[fx:50-(mean*100)] output.png on Setting specific image brightness but it said bash: syntax error near unexpected token ('


PS: the watermark is “好学近乎知 PDG” (To be fond of learning is to be near to knowledge PDG) which can be found at PDF files converted from PDG encrypted files in www.chaoxing.com (超星) which is a major Chinese E-book library. To remove the watermark we can set the brightness to 110 (cite from https://blog.csdn.net/shine78/article/details/8039265)


Solution

  • It is actually quite simple

    #!/bin/bash
    for filename in ./*.jpg; do
        magick "$filename" -brightness-contrast 10 "$filename"
    done