Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dither config #23

Merged
merged 2 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ Home Assistant related stuff:
| `ROTATION` | `0` | no | yes | Rotation of image in degrees, e.g. use 90 or 270 to render in landscape |
| `SCALING` | `1` | no | yes | Scaling factor, e.g. `1.5` to zoom in or `0.75` to zoom out |
| `GRAYSCALE_DEPTH` | `8` | no | yes | Ggrayscale bit depth your kindle supports |
| `COLOR_MODE` | `GrayScale` | no | yes | ColorMode to use, ex: `GrayScale`, or `TrueColor`. |
| `COLOR_MODE` | `GrayScale` | no | yes | ColorMode to use, ex: `GrayScale`, or `TrueColor`. |
| `DITHER` | `false` | no | yes | Apply a dither to the images. |

**\* Array** means that you can set `HA_SCREENSHOT_URL_2`, `HA_SCREENSHOT_URL_3`, ... `HA_SCREENSHOT_URL_n` to render multiple pages within the same instance.
If you use `HA_SCREENSHOT_URL_2`, you can also set `ROTATION_2=180`. If there is no `ROTATION_n` set, then `ROTATION` will be used as a fallback.
Expand Down
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function getPagesConfig() {
width: getEnvironmentVariable("RENDERING_SCREEN_WIDTH", suffix) || 600,
},
grayscaleDepth: getEnvironmentVariable("GRAYSCALE_DEPTH", suffix) || 8,
dither: getEnvironmentVariable("DITHER", suffix) || false,
colorMode: getEnvironmentVariable("COLOR_MODE", suffix) || "GrayScale",
rotation: getEnvironmentVariable("ROTATION", suffix) || 0,
scaling: getEnvironmentVariable("SCALING", suffix) || 1,
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ function convertImageToKindleCompatiblePngAsync(
.options({
imageMagick: config.useImageMagick === true,
})
.dither(pageConfig.dither)
.rotate("white", pageConfig.rotation)
.type(pageConfig.colorMode)
.bitdepth(pageConfig.grayscaleDepth)
Expand Down