Repository navigation
feat(plugins): add jxl plugin for JPEG XL export - #556
Merged
Merged
Conversation
Member
|
Thank you @jackskip22 ! Merging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a jxl plugin to @zumer/snapdom-plugins, as discussed in #541.
• jxl() adds toJxl(), toBlob({ format: 'jxl' }) and download({ format: 'jxl' }).
• Text and interface edges stay exact, photos follow the export's quality.
• Exports take the same options as toWebp(), plus effort (1-9, default 3), signal, onProgress and onEncoded. quality: 1 is exact.
• The encoder is rapier-jxl (MIT), loaded with import() the first time an export needs it.
• For browsers like Edge which can't display JPEG XL yet, toJxl() shows the result through an optional decoder or rejects with JXL_NOT_SHOWN. The saved Blob is always image/jxl.
Three requested fixes complete:
<html>is drawn from its top edge.Tests
__tests__/plugin.jxl.test.jsruns the encoder and checks that every pixel of the text sits inside an exact area on the canvas. Clipping, scrolled boxes, shadows, pseudo-elements, list markers, writing modes, form controls, excluded nodes, and<html>and<body>captures. Tests pass in Chromium, Firefox and WebKit.Packaging
packages/plugins/package.jsongets a ./jxl export and rapier-jxl 8.3.2 as an optional peer and dev dependency. The lockfile changes for that package and you are welcome to adjust any of it.Also noticed during testing: capturing
document.documentElementdrops the top margin that collapses through<body>so the page is drawn 8px too high with the default body margin and about 21px when the page starts with<h1>. Skipping documentElement inneutralizeRootMarginCollapseshould fix it and in the meantime, the plugin keeps such captures exact.