howardjones / network-weathermap

Network Weathermap draws diagrams from data
http://www.network-weathermap.com/
MIT License
425 stars 94 forks source link

WMImageLoader duplication/Icon colourising is partially broken #82

Closed howardjones closed 7 years ago

howardjones commented 7 years ago

Test case is in test-duplicate.php in the database-refactor branch.

There are 3 failing test cases useiconscale5, useiconscale8 and useiconscale10 which are all related to transparency and icon colourisation. Partly this also depends on the source image - the colourising function only works on a paletted image file.

imagecolorize() will try to convert a truecolor image to a paletted one, but doesn't deal well with transparency.

So - either need to get a better conversion function, a better colourising function, or accept the current ("broken") images as the new references.

howardjones commented 7 years ago

Colorizing with alpha now looks good, even with truecolor PNGs. The WMImageLoader duplication function mangles alpha data though. Since the new colorizing thing is going to be slower, the caching is definitely worth persuing.

howardjones commented 7 years ago

Remaining 4 failing tests are all for colorizing icons (USEICONSCALE) with an index-colour PNG with transparency. Looks like imagecolorize isn't actually preserving transparency.