d03n3rfr1tz3 / hass-divoom

Divoom Integration for Home Assistant
MIT License
99 stars 9 forks source link

Error when sending a gif image #6

Closed francescoditrani closed 2 years ago

francescoditrani commented 2 years ago

Hi, first of all thanks for this library, very useful :)

When sending a gif I'm getting this error:

Call-service error. int too big to convert

Maybe it has something to do with the color space. Do you have any hint?

francescoditrani commented 2 years ago

also, this is what I get analyzing the gif:

GIF Information

GIF size: 1,114 bytes (1.09kb) GIF length: 0 second(s) GIF width/height: 16×16 pixels number of frames: 1 number of colors: 256 loop count: 0 (endless)

Frame #1:

x: 0 y: 0 width: 16 height: 16 delay: 0ms disposal: 1 transparent: false transparency index: 0 (not used) transparency color: no (not used)

francescoditrani commented 2 years ago

using the "sharp" library from npm, if I use the "b-w" color space, the image is correctly sent, but of course the image is visualized in black and white.

francescoditrani commented 2 years ago

found out that it works if I lower the gif colors count to 128

d03n3rfr1tz3 commented 2 years ago

Well, I never saw or even expected a problem like that. I typically re-save all GIFs with GIMP 2 before using it and maybe that somehow lowers the color count in the palette to the amount that is needed. Or maybe I was just lucky with all the GIFs I use.

If you have any detailed logs especially regarding the call-stack, I could at least have a look, if it can be increased or worked around. I'm specifically looking at line 249 of pixoo.py, because that is the only place were a concrete type is even defined. I'll probably replace int() with long() here just to make sure, but it would be nice to know, if it could prevent this type of error already. Ok, ignore the line 249 idea. I should have looked closer before writing down my thoughts, because that obviously breaks it. Therefore I have no idea where that error could arise from.