Re: Issue when creating sprite: black becomes transparent

420 views
Skip to first unread message

Clément Danjou

unread,
Aug 1, 2012, 4:29:01 AM8/1/12
to compas...@googlegroups.com
I updated to the last alpha release (compass + sass + chunky_png + oily_png) instead of the current stable version. It seems that everything works now.
If someone encounters the same issue :

gem install compass sass oily_png chunky_png --pre

Le mardi 31 juillet 2012 15:00:37 UTC+2, Clément Danjou a écrit :
Hi,
I use Compass since few weeks, and I realize last week that generated sprites have a color issue. In fact, all black pixels in original images become transparent. It's like it considers #000000 as an alpha mask.

I tried to uninstall / install compass, chunky_png and oily_png, but nothing happens. Or no, it worked ! Like 2 hours, and next generation was bad again.
I can't understand, sometimes I remove oily and it works, and after, it goes wrong. I reinstall oily, and nothing happens. Or sometimes it works.
Well, I have no explanation. Same issue appears on 3 different machine with same configuration with same random results :

Debian Squeeze
Compass 0.12.2 (Alnilam)
Sass 3.1.19 (Brainy Betty)
chunky_png (1.2.5)
oily_png (1.0.2)
gem 1.8

Clément Danjou

unread,
Aug 1, 2012, 4:38:39 AM8/1/12
to compas...@googlegroups.com
Argh. In fact that didn't work. This worked yesterday, and this morning, the bug appeared again : all black pixels become transparent. As I said before, it's a random bug : it works, it don't work anymore, it works, ... And I'm pretty sure it will work soon for a couple of hours...

If someone has a real solution :(

Clément Danjou

unread,
Aug 1, 2012, 12:10:03 PM8/1/12
to compas...@googlegroups.com
Ok, finally, I've found the solution.

I use many sprite. If one original image file in a sprite is in RGB, it triggers the bug on ALL sprites. Why ? I don't know.
The random effect was certainly due to order of sprite compilation : few generations triggered the bug for generations that happen after them.

I converted every RGB image in RGBA with Imagemagick CLI, and the issue was solved.

Andrey Kuzmin

unread,
Mar 28, 2014, 1:03:11 PM3/28/14
to compas...@googlegroups.com
Hello! This is 2014 and I have the same issue. Thanks for the RGBA tip, I ran this python script https://gist.github.com/w0rm/9837645 and it seemed to fix this issue.




On Thursday, November 1, 2012 10:26:30 AM UTC+4, Bill Doughty wrote:
Hi, Clémont.  So glad to see someone else was having this obscure problem too.  It took me a while to find this article after I finally realized the problem was mostly random.  This problem has been plaguing me for two days now, whether using chunky_png or oily_png .  For me it's white that is turning transparent for all images in the sprite map.  I'm guessing it has to do with images with an indexed color pallet with a color that is set to be transparent.  

Do you have the imagemagick command to convert RGB to RGBA?  I tried this:

$ convert $file -channel rgba -alpha on -colorspace rgb $file

but it darkened all my images and I'm still having the problem.

I'm continue researching the imagemagick docs.  If I figure out it out before you (or don't) post back, I will post back with those details.  That will make this article even more helpful for anyone else having this problem.  Keywords: compass, sprite, transparent, transparency, issue, problem.

Thanks so much for posting this!  It set me on the path.

Bill

Chris Eppstein

unread,
Apr 7, 2014, 7:20:35 PM4/7/14
to compas...@googlegroups.com, l4p1...@gmail.com
I filed a bug against chunky_png to get advice on what we can do to mitigate this in our code.

Reply all
Reply to author
Forward
0 new messages