Skip to content

Fix manual levels rendering by aligning ImageMagick -level arguments#18

Merged
ikraamg merged 1 commit intousetrmnl:mainfrom
alikaragoz:main
Jan 15, 2026
Merged

Fix manual levels rendering by aligning ImageMagick -level arguments#18
ikraamg merged 1 commit intousetrmnl:mainfrom
alikaragoz:main

Conversation

@alikaragoz
Copy link
Copy Markdown
Contributor

@alikaragoz alikaragoz commented Jan 14, 2026

Manual Levels were producing nearly black previews even with mild settings. The root cause was argument order: gm.level() follows GraphicsMagick’s black,gamma,white, while our pipeline runs ImageMagick, which expects black,white,gamma.
That mismatch effectively applied an unintended gamma and crushed mid‑tones.

This change bypasses gm.level() and emits ImageMagick’s -level black%,white% directly in the grayscale dithering path. It keeps the intended black/white point adjustments without disturbing the rest of the pipeline (normalize, dithering method, palette selection).

Before/After

before after

Copy link
Copy Markdown
Collaborator

@ikraamg ikraamg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing, thank you!

This brings up the thought I'd been pondering on. I think we need to move to a different wrapper around imagemagick. GM is not in development anymore.

@alikaragoz
Copy link
Copy Markdown
Contributor Author

Amazing, thank you!

This brings up the thought I'd been pondering on. I think we need to move to a different wrapper around imagemagick. GM is not in development anymore.

Thanks for the review. From my preliminary tests GM seemed to produce better dithering, but I did not do deep comparison. Feel free to merge or switch to GM 😇

@ikraamg
Copy link
Copy Markdown
Collaborator

ikraamg commented Jan 15, 2026

10-4 on graphics magick vs imagemagick. Mostly switched for convenience as other tmrnl tooling uses imagemagick. It does make it weird using the node gm wrapper around imagemagick so will likely need to pick a lane more strongly if stuff like this surfaces too often.

@ikraamg ikraamg merged commit 3b95856 into usetrmnl:main Jan 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants