I have multiple pictures that are look alike, they're all black and differ only in the one dot of the screen, I want to combine them in one picture so I can see all the dots in one picture. How can I do this using something like ImageMagic? I don't want to use something with gui bc there are a lot of pictures, but they're not that big, so it would be easier to do this with terminal utility. I tried

composite -blend 50 *.png res.png

but it didn't work out.

UPD: Now I understood that it doesn't work because it works only with two images, how do I do these to all the images that matches the regular expression like somth*.png?

  • "didn't work" is a poor description. All it conveys is you could not achieve your goal. Please describe precisely what happens when you try that command.
    – Quasímodo
    Oct 10 '20 at 14:57
  • It shows only the last dot, I guess, and not the others, at least I can't see them
    – Arzybek
    Oct 10 '20 at 14:59
  • Is unix.stackexchange.com/q/329886 of any help?
    – Quasímodo
    Oct 10 '20 at 15:18
  • Not really, because it's not the problem to do many files, the main problem is how to overlay them correctly
    – Arzybek
    Oct 10 '20 at 15:26
  • for blending, is there a logic function available, such as OR or AND? ... perhaps, convert black to transparent
    – jsotola
    Oct 10 '20 at 15:48

You need the Screen compositing method.

Since the composition only accepts two input files at a time, loop over all the input files.

Substitute somth1.png below by any of the input files. It is needed because res.png is always a starting point.

cp somth1.png res.png 
for f in somth*.png;
    do composite -compose Screen "$f" res.png res.png

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.