Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting colours to transparency #23

Open
qururoland opened this issue Mar 14, 2019 · 0 comments
Open

Converting colours to transparency #23

qururoland opened this issue Mar 14, 2019 · 0 comments

Comments

@qururoland
Copy link
Contributor

With the mask it is possible to make an image into a circle (have a white mask with a transparent circle in the middle and overlay it over the image) however the circular image remains on a coloured background. Would it be possible to convert the colour of the background to transparent?

To find the colour in a simple mask:
convert mask.gif -format %c -colorspace LAB -colors 5 histogram:info:- | sort -n -r | grep -v "#00000000"
will show the 5 most dominant colours in the image.
convert image.png -fuzz 20% -transparent "#ff00ffff" transparentimage.png
will make all #ff00ffff pixels transparent.

Note that glflib is possibly quicker for getting the colour (need giflib-tools)
gifclrmp mask.gif | grep -r "#00000000"`

Note that 2 colour gif palettes for the mask make this much easier. The fuzz option (ie needed for anti-aliasing etc) might need playing with.

It is possible that someone might want to make a colour in the original image transparent rather than in a mask...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant