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

Allow Mask/pngs #7

Closed
vickilindsay opened this issue Jul 21, 2016 · 0 comments
Closed

Allow Mask/pngs #7

vickilindsay opened this issue Jul 21, 2016 · 0 comments

Comments

@vickilindsay
Copy link

I would like to be able to run this on an image with a mask: so ignoring the areas marked by the mask when generating the color pallet. Accepting a mask, or alternately accepting pngs with a mask applied would be very helpful.

Here is what I have tried so far:
-I have tried adding the mask to the image, and giving imagecolors.extract the path to the resulting png with the background set to transparent, however then I receive the error 'Histogram extraction failed’. I see that that means no chunks were detected within the histogram, however I cannot figure out why that is the case.

-I have forked the code within my project and am trying to find a way to mask out the background using imagemagick. I have tried passing in both the mask and the image, and using imagemagick to run im(image path).mask(mask path), then running imagecolors like normal on that, however the background is still not ignored. I still end up extracting colors from the background. Upon further research i discovered imagemagick.mask simply write-protects those pixels, and so doesn’t prevent imagemagic from reading them in the histogram.

-I see that in the non-node version of image graphics the correct way to apply a mask is using composite, and have found this command: convert image.jpeg mask.jpeg -alpha off -compose copy_opacity -composite result.png. I see that in the npm gm you should be able to add custom commands from imagegraphics, however I have not yet been able to get this command to work succesfully.

Any work around suggestions would be appreciated, Thanks!
Vicki

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

No branches or pull requests

2 participants