sibbl / hass-lovelace-kindle-screensaver

This tool generates a png from a Home Assistant Lovelace view, which can be displayed on a Kindle device which has the Online Screensaver plugin installed.
MIT License
333 stars 74 forks source link

convert: unrecognized dither method `-background' @ error/convert.c/ConvertImageCommand/1403.` #30

Closed blockarchitech closed 7 months ago

blockarchitech commented 2 years ago

When using dithering, the error

convert: unrecognized dither method `-background' @ error/convert.c/ConvertImageCommand/1403. 

Is thrown, using the latest version of the docker image.

MartinLindenau commented 8 months ago

With 1.0.5 the same problem.

cannondale0815 commented 7 months ago

Confirming the same in add-on 1.0.7 still. Running Home Assistant OS on raspberry-pi 4.

`Starting browser... Visiting 'http://192.168.1.10:8123' to login... Adding authentication entry to browser's local storage... Starting first render... Rendering http://192.168.1.10:8123/dashboard-kindle/0 to image... Converting rendered screenshot of http://192.168.1.10:8123/dashboard-kindle/0 to grayscale png... /app/node_modules/gm/lib/command.js:301 err = new Error('Command failed: ' + stderr); ^

Error: Command failed: convert: unrecognized dither method `-background' @ error/convert.c/ConvertImageCommand/1422.

at ChildProcess.onExit (/app/node_modules/gm/lib/command.js:301:17)
at ChildProcess.emit (node:events:517:28)
at maybeClose (node:internal/child_process:1098:16)
at Socket.<anonymous> (node:internal/child_process:450:11)
at Socket.emit (node:events:517:28)
at Pipe.<anonymous> (node:net:350:12) {

code: 1, signal: null } `

cannondale0815 commented 7 months ago

@sibbl Hi Sebastian, seems like an older issue -- just wanted to call attention to it as it seems to be buried all the way at the bottom. Thanks mate!

cannondale0815 commented 7 months ago

Wow, it looks like @sibbl just released 1.0.8 and it fixes this error! Thank you!!

sibbl commented 7 months ago

Hi @cannondale0815 the error from version 1.0.7 was kind of related to this one, but I'd like to keep this one open.

In addition, I'd like to quote my findings from the other bug report:

The cause of this might be that our Dockerfile uses imagemagick instead of graphicsmagick. While the used npm module gm says to be compatible with both, it doesn't seem to support the differences in the dither parameter. While +dither works for both, the -dither parameter requires the name of the dither algorithm to use in imagemagick, while graphicsmagick only uses it as a toggle.

Maybe it's worth to give Graphicsmagick another try in the Dockerfile but I'm not sure what other incompatibilities will occur. An alternative would be to open an issue in the gm npm package repository. Finally, we could also just use the "custom arguments" feature of the gm npm package to support -dither ALGORITHM and ´+dither` by our own. That's probably what I'd prefer.

https://github.com/sibbl/hass-lovelace-kindle-screensaver/issues/112#issuecomment-1960877672

So probably the last option might also finally solve this issue here.

blockarchitech commented 7 months ago

I totally forgot I had this open! Thanks again, @sibbl !