Page 2 of 2

Re: composite -blend 1% [and how to add "darken only"]?

Posted: 2011-09-28T17:11:59-07:00
by jkop
Thanks, how does one write such a loop, for example, with the following command

convert *.png +level 99%,100% \
-compose linear_burn -background white -flatten \
shadow_merge_result.png

?

Re: composite -blend 1% [and how to add "darken only"]?

Posted: 2011-09-28T17:33:45-07:00
by fmw42
jkop wrote:Thanks, how does one write such a loop, for example, with the following command

convert *.png +level 99%,100% \
-compose linear_burn -background white -flatten \
shadow_merge_result.png

?
No, that would not work.

You have to create a list of all your files and write a while or for loop to loop over each image and composite it with the previous result.

Are you on Unix or Windows?

Re: composite -blend 1% [and how to add "darken only"]?

Posted: 2011-09-28T18:22:36-07:00
by anthony
If all the images (100 is not many) can be read into memory without problems, then no loop is needed, just read them all at once.

If the images are very large and the command becomes very slow, you can do it in batches, using the same command
just do say the first 20 images (or however many works for your computers memory), then that result and the next 20 images, and so on until you have done all the images.

The compose method is associative, meaning order of the images does not matter at all!

You can use the same image for the result at each stage as IM completely reads the images given as input, before opening (for over-write, if it already exists) the output image.

If you want to just do two at a time you can use the -composite operator (no need for -background then) to merge them together. Again order of merges does not matter.

Re: composite -blend 1% [and how to add "darken only"]?

Posted: 2011-09-28T23:22:14-07:00
by jkop
Okay, thanks, I can process them in groups of 10 or the like. I'm on Linux :D

Re: composite -blend 1% [and how to add "darken only"]?

Posted: 2011-09-29T21:02:15-07:00
by jkop
Hm, well for

convert *.png +level 99%,100% \
-compose linear_burn -background white -flatten \
shadow_merge_result.png

it doesn't seem to work to process say 5 groups of 20 images separately and then process the 5 results into one result. Processing 20 to 1 resultimage works fine, but processing 5 resultimages merely results in some washed out white image (it should disregard the white, not add it). I tried to remove the -background white option, but without luck. Am I missing something? :/

Re: composite -blend 1% [and how to add "darken only"]?

Posted: 2011-09-29T23:04:14-07:00
by anthony
-background white is actually the default setting so removing it has not effect. I add it as a precaution.

Ah... in the final merge of 5 images, the images are already 'level' correctly. As such the washed out look would be because of a second 'level' operation being applied. the +level should only be applied to the initial pure black and white images.

Remove the +level 99%,100% from the final merger should fix the problem..

If you are doing a 'progressive' merge then the first line should be...

Code: Select all

   convert previous_result.png \( new_shadows_*.png +level 99%,100% \) \
                  ....

Re: composite -blend 1% [and how to add "darken only"]?

Posted: 2011-10-05T07:41:13-07:00
by jkop
That works!

Code: Select all

convert *.png -compose linear_burn -flatten shadow_merge_result.png
correctly superimposes the 5 partial superimpositions into one.


Thank you very much :)