viv
viv copied to clipboard
Support for "JPEG-2000 Lossy"?
User story
Ome-tiff supports lossy JPEG-2000 compression. On my particular dataset I converted it with bftools -compression
set to JPEG-2000 Lossy
. This reduced my image file from around 1mb each to 250kb. This reduction has positive performance implications for a web application that is fetching this data. The lossy compression may be an acceptable tradeoff in some cases for smaller file sizes.
I am currently using loadOmeTiff
to load my files; however this does not appear to support JPEG-2000 Lossy
.
Preferred solution
If loadOmeTiff
supported JPEG-2000 Lossy
and could decode it quickly it would give a more performant option for applications that fetch a lot of images.
Possible alternatives
I tried all the compression supported by bfconvert
:
- zlib: This is potentially the next best option. My files were reduced from 1mb to 850kb. zlib seems to have an optimization option, but not sure if there's a way to select this with bfconvert.
- LZW: files were larger
- JPEG: did not work for my files
- JPEG-2000: My files were reduced from 1mb to 900kb.
- JPEG-2000 Lossy: My files were reduced from 1mb to 250kb.
Open to any other suggestions for reducing file size. The resolution of the files are not large. These are 767x767 pixels with a single channel of data. 1MB seems like could be reduced, especially if lossy compression is acceptable.
@Dev-Lan If you could compile a JPEG2000 compressor to wasm (written in e.g., C), you could use it by registering it as a codec. See here for an example of how we set up the class for this for lzw. You can then register the codec with geotiff according to the integer number in the tiff file for that compression algorithm (for LZW, for example, it is 5).