Make Pixel Transparent Based on Level

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
justin9999
Posts: 1
Joined: 2018-01-17T22:53:25-07:00
Authentication code: 1152

Make Pixel Transparent Based on Level

Post by justin9999 »

Is there a way to make a pixel transparent based on its brightness level?

I would like to be able to make all pixels transparent that are in the bottom 50% of the brightness range. Let's call this image A, and say it is derived from a photo that is overexposed.

I would like to be able to make all pixels transparent that are in the top 50% of the brightness range. Let's call this image B, and say it is derived from a photo that is underexposed.

I would like to see what happens when I blend images A and B together. I hope to make an HDR image.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Make Pixel Transparent Based on Level

Post by snibgo »

What version of IM on what platform? I'll assume v6 on Windows CMD.
justin9999 wrote:I would like to be able to make all pixels transparent that are in the bottom 50% of the brightness range.... top 50%...

Code: Select all

convert toes.png ( +clone -colorspace Gray -fuzz 50% -transparent Black ) -compose CopyOpacity -composite imgA.png

convert toes.png ( +clone -colorspace Gray -fuzz 50% +transparent Black ) -compose CopyOpacity -composite imgB.png
snibgo's IM pages: im.snibgo.com
Post Reply