Skip to content

add jpeg codec and testcases#81

Open
konstibob wants to merge 2 commits into
zarr-developers:mainfrom
konstibob:feat/jpeg-codec
Open

add jpeg codec and testcases#81
konstibob wants to merge 2 commits into
zarr-developers:mainfrom
konstibob:feat/jpeg-codec

Conversation

@konstibob

Copy link
Copy Markdown

Add JPEG codec (v3)

Implements an array → bytes JPEG codec for the Zarr v3 codec pipeline, compatible with neuroglancer's precomputed "jpeg" chunk encoding.

  • Encodes a uint8 chunk as a baseline JPEG image and decodes it back.
  • The innermost chunk axis is treated as the channel axis: extent 3 → RGB, otherwise grayscale (1 channel).
  • Configurable quality (0–100, default 90); validated on construction.
  • Serializes to / deserializes from zarr.json ("name": "jpeg", "quality": …).

Notes / limitations

  • Lossy — must not be used where exact values matter
  • Only supports uint8; other dtypes are rejected with a clear error.
  • Chunks exceeding JPEG's 65535-per-dimension limit are factored to fit, or rejected if no factorization works.

@normanrz normanrz 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.

We'll also discuss this extensions PR, but my main feedback is that the jpeg codec should not change the data that is passed in upon encoding. It should throw errors, if incompatible data is being written. Otherwise, it should rely on other codecs (e.g. transpose, reshape) to make the data compatible with what jpeg can store.

Comment thread src/main/java/dev/zarr/zarrjava/v3/codec/core/JpegCodec.java Outdated
Comment thread src/main/java/dev/zarr/zarrjava/v3/codec/core/JpegCodec.java Outdated
Comment thread src/main/java/dev/zarr/zarrjava/v3/codec/core/JpegCodec.java Outdated
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