Skip to content

feat(server): JXL previews from DNG 1.7+ - #17861

Merged
mertalev merged 11 commits into
immich-app:mainfrom
eligao:feat/jxl-from-raw
Apr 28, 2025
Merged

mertalev merged 11 commits into
immich-app:mainfrom
eligao:feat/jxl-from-raw

Conversation

@eligao

@eligao eligao commented Apr 24, 2025 •

Copy link
Copy Markdown
Contributor

Description

This MR adds support of DNG 1.7+ files with JXL previews.

Specifically from Adobe DNG converter, when "Use Lossy Compression" is enabled, and compatibility is set to DNG 1.7+, both the converted main RAW image and its embedded preview are encoded in JXL, which significantly reduces file size without noticable artifacts.
image

This does not fix decoding issue of JXL-encoded DNGs in #13029
but mitigates the issue when "Prefer embedded preview" is enabled.

How Has This Been Tested?

  • Convert a JXL DNG with Adobe DNG converter. Upload it to immich, and it should show thumbnail/preview/fullsize image properly. One example file: JXL_PREVIEW.zip

Screenshots (if appropriate)

image

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
    • Not applicable, as the doc never specified supported DNG version anyways
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
    • Unit tests for JXL preview of DNG was added
    • E2E tests were not added, as JXL RAW body is not yet supported, which breaks should upload and generate a thumbnail for different file types
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)

@eligao
eligao requested a review from danieldietzler as a code owner April 24, 2025 20:14
@eligao
eligao marked this pull request as draft April 24, 2025 20:15
@eligao eligao changed the title [WIP] feat(server): JXL previews from RAW feat(server): JXL previews from DNG 1.7+ Apr 24, 2025
@uhthomas

uhthomas commented Apr 25, 2025 •

Copy link
Copy Markdown
Collaborator

Does this serve JXL previews to browsers?

@eligao

eligao commented Apr 25, 2025

Copy link
Copy Markdown
Contributor Author

Does this serve JXL previews to browsers?

Nah, but it can be enabled by simply adding JXL to the webSupportedImageMimeTypes list when enough browsers/clients support it.

See discussions in #9056 (comment)

@eligao
eligao marked this pull request as ready for review April 26, 2025 19:19
Comment thread server/src/services/media.service.ts Outdated
Comment thread server/src/enum.ts
Comment thread server/src/services/media.service.ts Outdated

@mertalev mertalev left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I tried to break up generateImageThumbnails a bit, which was easier now that there's more separation between the decoding and the file saving. Extracting the JXL preview from the sample image seems to work fine and I don't notice any regressions for other assets.

@mertalev
mertalev merged commit 48bcbee into immich-app:main Apr 28, 2025
@eligao

eligao commented Apr 29, 2025

Copy link
Copy Markdown
Contributor Author

I tried to break up generateImageThumbnails a bit, which was easier now that there's more separation between the decoding and the file saving. Extracting the JXL preview from the sample image seems to work fine and I don't notice any regressions for other assets.

nice touch, looks much neater :)

@eligao
eligao deleted the feat/jxl-from-raw branch April 29, 2025 07:09
Comment thread server/src/services/media.service.ts
savely-krasovsky pushed a commit to savely-krasovsky/immich that referenced this pull request Jun 8, 2025
* feat(server): JXL previews from RAW

* refactor(server): use var name assumedExtractedFormat for clarity

* test(server): fix existing media.extract() returning JPEG

* chore(openapi): regen

* style(server): lint

* fix(server): ignore undefined decode orientation

* fix(server): correct orientation assignment in media decode options

* test(server): unit tests of JXL-encoded DNG

* refactor(server): return buffer and format from mediaRepository.extract()

* chore(open-api): regen

* refactor

---------

Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants