0

I have a sequence of images {image_0001.png, image_0002.png, ...} from which i'd like to substract a blured background using ImageMagick.

The one of the source image.

A source image

It is its blured version.

A blured version of the image

To find a blured background and extract it from a source image, I execute the following command:

    magick *.png -auto-level \ 
        ( +clone -blur 90x40 ) -compose subtract -composite diff-%04d.png

But I obtain only one image and result is ugly.

The ugly result

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
Ivan Z
  • 1,517
  • 1
  • 16
  • 25
  • You almost never want `magick convert ...` see stackoverflow.com/a/61208844/2836621 – Mark Setchell Mar 31 '23 at 11:32
  • Try doing one at a time with `magick input.jpg -auto-level \( +clone -blur 90x40 \) -compose difference -composite result.jpg` – Mark Setchell Mar 31 '23 at 11:39
  • @MarkSetchell, I have thousands of files. – Ivan Z Mar 31 '23 at 12:23
  • Use **GNU Parallel** then. Example here https://stackoverflow.com/a/26169406/2836621 and https://stackoverflow.com/search?q=user%3A2836621+parallel+%5Bimagemagick%5D – Mark Setchell Mar 31 '23 at 15:58
  • Do not try to use wild cards for input to magick (or convert) and expect multiple outputs when you do composite. You will have to write a script FOR loop over each input image and do your processing that way. – fmw42 Mar 31 '23 at 16:27

0 Answers0