When using bfconvert with JPEG-2000 compression in lossy mode, the -quality parameter does not appear to have any effect on the output file size (and presumably bitrate). Regardless of the value provided, the resulting OME-TIFF files are identical in size.
I also tried first converting the image to a flat TIFF in Fiji and then converting that TIFF to OME-TIFF, but I still observed the same behavior.
This happens both when explicitly specifying -compression "JPEG2000 Lossy" compression and when relying on -quality to trigger lossy encoding.
Commands used
test image: https://doi.org/10.5281/zenodo.19591867
bfconvert \
-bigtiff \
-pyramid-resolutions 4 \
-pyramid-scale 2 \
-compression "JPEG2000 Lossy" \
-quality 100 \
test_image.nd2 test_image_JPEG200_Lossy_Q100.ome.tiff
Log
ND2Reader initializing test_image.nd2
Searching for blocks
Parsing block 'ND2 FILE SIG' 0%
Parsing block 'ImageCalibra' 0%
Parsing block 'ImageMetadat' 0%
Parsing block 'ImageTextInf' 0%
Parsing block 'CustomDataVa' 0%
Parsing block 'ImageDataSeq' 0%
Parsing block 'ImageDataSeq' 0%
Parsing block 'CustomDataVa' 99%
Parsing block 'CustomData|C' 99%
Parsing block 'CustomData|C' 99%
Parsing block 'CustomData|C' 99%
Parsing block 'CustomData|C' 99%
Parsing block 'CustomData|C' 99%
Parsing block 'CustomData|P' 99%
Parsing block 'CustomData|P' 99%
Parsing block 'CustomData|X' 99%
Parsing block 'CustomData|Y' 99%
Parsing block 'CustomData|Z' 99%
Parsing block 'CustomData|Z' 99%
Parsing block 'CustomData|Z' 99%
Parsing block 'ImageAttribu' 99%
Parsing block 'CustomData|A' 99%
Parsing block 'ND2 FILEMAP ' 99%
[Nikon ND2] -> test_image_JPEG200_Lossy_Q100.ome.tiff [OME-TIFF]
Tile size = 8256 x 64
Converted 1/3 planes (33%)
Converted 2/3 planes (66%)
Converted 3/3 planes (100%)
Tile size = 4128 x 64
Converted 1/3 planes (33%)
Converted 2/3 planes (66%)
Converted 3/3 planes (100%)
Tile size = 2064 x 64
Converted 1/3 planes (33%)
Converted 2/3 planes (66%)
Converted 3/3 planes (100%)
Tile size = 1024 x 64
Converted 1/3 planes (33%)
Converted 2/3 planes (66%)
Converted 3/3 planes (100%)
[done]
791.811s elapsed (98.166664+65389.668ms per plane, 5432ms overhead)
The issue persists regardless of whether "JPEG2000" or "JPEG2000 Lossy" is specified with varying `-quality` values.
Observed behavior
Output file size remains identical (~5.8 MB) across a wide range of -quality values (e.g., 3, 5, 10, 50, 100, 1000)
No apparent change in compression ratio or visual quality
| Compression |
Quality |
File size |
| Original (.nd2) |
– |
403.3 MB |
| JPEG2000 Lossy |
8 |
5.8 MB |
| JPEG2000 Lossy |
1000 |
5.8 MB |
| JPEG2000 Lossy |
- |
5.8 MB |
| JPEG2000 (no explicit quality) |
- |
222.4 MB |
| LZW |
– |
344.1 MB |
Expected behavior
The -quality parameter should affect JPEG-2000 compression bitrate
Lower quality → smaller file size
Higher quality → larger file size (approaching lossless)
Environment
bftools versions tested:
- 8.1.1 (in conda environment)
- 8.5.0 (downloaded from the website)
OS: Rocky Linux 9.5 (Blue Onyx)
Hardware: AMD EPYC 9224 (HPC environment)
Input format: Nikon .nd2
When using
bfconvertwith JPEG-2000 compression in lossy mode, the-qualityparameter does not appear to have any effect on the output file size (and presumably bitrate). Regardless of the value provided, the resulting OME-TIFF files are identical in size.I also tried first converting the image to a flat TIFF in Fiji and then converting that TIFF to OME-TIFF, but I still observed the same behavior.
This happens both when explicitly specifying
-compression "JPEG2000 Lossy"compression and when relying on-qualityto trigger lossy encoding.Commands used
test image: https://doi.org/10.5281/zenodo.19591867
Log
ND2Reader initializing test_image.nd2 Searching for blocks Parsing block 'ND2 FILE SIG' 0% Parsing block 'ImageCalibra' 0% Parsing block 'ImageMetadat' 0% Parsing block 'ImageTextInf' 0% Parsing block 'CustomDataVa' 0% Parsing block 'ImageDataSeq' 0% Parsing block 'ImageDataSeq' 0% Parsing block 'CustomDataVa' 99% Parsing block 'CustomData|C' 99% Parsing block 'CustomData|C' 99% Parsing block 'CustomData|C' 99% Parsing block 'CustomData|C' 99% Parsing block 'CustomData|C' 99% Parsing block 'CustomData|P' 99% Parsing block 'CustomData|P' 99% Parsing block 'CustomData|X' 99% Parsing block 'CustomData|Y' 99% Parsing block 'CustomData|Z' 99% Parsing block 'CustomData|Z' 99% Parsing block 'CustomData|Z' 99% Parsing block 'ImageAttribu' 99% Parsing block 'CustomData|A' 99% Parsing block 'ND2 FILEMAP ' 99% [Nikon ND2] -> test_image_JPEG200_Lossy_Q100.ome.tiff [OME-TIFF] Tile size = 8256 x 64 Converted 1/3 planes (33%) Converted 2/3 planes (66%) Converted 3/3 planes (100%) Tile size = 4128 x 64 Converted 1/3 planes (33%) Converted 2/3 planes (66%) Converted 3/3 planes (100%) Tile size = 2064 x 64 Converted 1/3 planes (33%) Converted 2/3 planes (66%) Converted 3/3 planes (100%) Tile size = 1024 x 64 Converted 1/3 planes (33%) Converted 2/3 planes (66%) Converted 3/3 planes (100%) [done] 791.811s elapsed (98.166664+65389.668ms per plane, 5432ms overhead)Observed behavior
Output file size remains identical (~5.8 MB) across a wide range of -quality values (e.g., 3, 5, 10, 50, 100, 1000)
No apparent change in compression ratio or visual quality
Expected behavior
The
-qualityparameter should affect JPEG-2000 compression bitrateLower quality → smaller file size
Higher quality → larger file size (approaching lossless)
Environment
bftools versions tested:
OS: Rocky Linux 9.5 (Blue Onyx)
Hardware: AMD EPYC 9224 (HPC environment)
Input format: Nikon .nd2