Skip to content

Commit

Permalink
Merge pull request #18 from lanrat/color_config
Browse files Browse the repository at this point in the history
add support for changing the color mode
  • Loading branch information
sibbl authored Nov 22, 2021
2 parents 24eb068 + b45c198 commit 0694906
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ 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`. |

**\* 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,
colorMode: getEnvironmentVariable("COLOR_MODE", suffix) || "GrayScale",
rotation: getEnvironmentVariable("ROTATION", suffix) || 0,
scaling: getEnvironmentVariable("SCALING", suffix) || 1,
});
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ function convertImageToKindleCompatiblePngAsync(
imageMagick: config.useImageMagick === true,
})
.rotate("white", pageConfig.rotation)
.type("GrayScale")
.type(pageConfig.colorMode)
.bitdepth(pageConfig.grayscaleDepth)
.write(outputPath, (err) => {
if (err) {
Expand Down

0 comments on commit 0694906

Please sign in to comment.