Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/main/java/dev/zarr/zarrjava/v3/codec/CodecBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,34 @@ public CodecBuilder withZstd() {
return withZstd(5, true);
}

public CodecBuilder withJpeg(int quality) {
try {
codecs.add(new JpegCodec(new JpegCodec.Configuration(quality)));
} catch (ZarrException e) {
throw new RuntimeException(e);
}
return this;
}

public CodecBuilder withJpeg(int quality, String encodedColorSpace) {
return withJpeg(quality, encodedColorSpace, null);
}

public CodecBuilder withJpeg(int quality, String encodedColorSpace, int[][] subsampling) {
try {
codecs.add(new JpegCodec(
new JpegCodec.Configuration(quality, encodedColorSpace, subsampling)));
} catch (ZarrException e) {
throw new RuntimeException(e);
}
return this;
}

public CodecBuilder withJpeg() {
codecs.add(new JpegCodec());
return this;
}

public CodecBuilder withZstd(int level) {
return withZstd(level, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class CodecRegistry {
addType("blosc", BloscCodec.class);
addType("gzip", GzipCodec.class);
addType("zstd", ZstdCodec.class);
addType("jpeg", JpegCodec.class);
addType("crc32c", Crc32cCodec.class);
addType("sharding_indexed", ShardingIndexedCodec.class);
}
Expand Down
Loading