Closed yaeda closed 8 years ago
:eyes:
I'm sorry for late review :bow: And thanks for your detailed explanation and great fix! To be honest, I'm not sure that this fix is the best or not. But I could check that some icons are fixed.
So I'll merge this PR! Thanks again!
Fix #40
My rough investigation found png file format difference and ImageIO's strange behavior, and I added a tiny workaround for this issue.
Icon PNG File Format
PNG has several formats to optimize file size. Following table shows Bit Depth and Color Type of
ic_add_white_<xx>dp.png
undersrc/com/konifar/material_icon_generator/icons/content/drawable-xxhdpi
Color Type 4 means grayscale + alpha Color Type 3 means indexed color with pallet Color Type 0 means just grayscale (alpha information stored in tRNS chunk)
Please look
ic_add_white_24dp.png
andic_add_white_48dp.png
. They have only two kind of pixels.0x00FFFFFF
or0xFF000000
.ImageIO behavior
All material icons have alpha channel, but it disappears for some files such as
ic_add_white_24dp
and48dp
.hasAlpha()
returnsfalse
.I didn't check all of icons but I think this issue occurs in the file which has 0 color type.
Workaround
I think there are three options to fix this issue.
This PR realizes option 3 like this,
Reference
Thanks for reading and sorry for my loooong explanation.... :bow: