Hello,
I am an imagemagick rookie, and I am trying to apply a mask on a black n white photo, so in the end, I have black of the photo turned to transparent.
I am transforming #000000 to #010101 for the original image to begin with, but when, after applying the mask I am turning all true black to transparent, I need to use a fuzz factor of 3%. And that again creates transparency in my photo obviously.
Is there something else I can do other than setting fuzz to 0% or turning the original true black to an even lighter gray?
Here is my script now:
convert ${previousline} -fill '#010101' -opaque '#000000' -scale 620x380+0+0 ${targetfile}
convert ${template-pic-mask_local} ${previousline} -geometry +48+52 ${template-pic-mask_local} -compose multiply -composite ${targetfile}
convert ${previousline} -fuzz 3% -transparent '#000000' ${targetfile}
convert ${template-pic-main_local} ${previousline} -geometry +241+25 -composite ${targetfile}
Any help will be very much appreciated! Thank you in advance
IM masking question on black transforms
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: IM masking question on black transforms
You have four convert commands. They all create or re-create ${targetfile}. So the first three have zero effect.
I don't understand what you want to do. Perhaps you want to make all black pixels transparent, and leave all the others untouched. If so, then:
I don't understand what you want to do. Perhaps you want to make all black pixels transparent, and leave all the others untouched. If so, then:
Code: Select all
convert in.png -transparent Black out.png
snibgo's IM pages: im.snibgo.com
Re: IM masking question on black transforms
I forgot to mention that {$previousline} always dynamically get the result of each previous command's {$targetfile}.
So I can see that the first four commands are working.
The biggest issue is that fuzz takes along non-true black pixels, pixels of the original photo. While the mask needs the fuzz factor to be applied smoothly.
I hope this helps into understanding the issue.
So I can see that the first four commands are working.
The biggest issue is that fuzz takes along non-true black pixels, pixels of the original photo. While the mask needs the fuzz factor to be applied smoothly.
I hope this helps into understanding the issue.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: IM masking question on black transforms
So each ${previousline} is the previous command's ${targetfile}? That makes debugging "interesting". Why not use just one command? Any other weird rules we need to know about?
Sorry, I still don't know what you are trying to do. If you supplied your input files, that might help.
Sorry, I still don't know what you are trying to do. If you supplied your input files, that might help.
snibgo's IM pages: im.snibgo.com