Fix manual levels rendering by aligning ImageMagick -level arguments#18
Fix manual levels rendering by aligning ImageMagick -level arguments#18ikraamg merged 1 commit intousetrmnl:mainfrom
-level arguments#18Conversation
ikraamg
left a comment
There was a problem hiding this comment.
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 😇 |
|
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. |
Manual Levels were producing nearly black previews even with mild settings. The root cause was argument order:
gm.level()followsGraphicsMagick’s black,gamma,white, while our pipeline runs ImageMagick, which expectsblack,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