Skip to content

Instantly share code, notes, and snippets.

@jpstroop
Created October 15, 2016 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpstroop/75370e438cdce8f34817c475e6eb5969 to your computer and use it in GitHub Desktop.
Save jpstroop/75370e438cdce8f34817c475e6eb5969 to your computer and use it in GitHub Desktop.
Proof that OpenJPEG and Kakadu both round up when discarding resolution levels
$ kdu_expand -quiet -i 0001.jp2 -o 0001.bmp -reduce 0; identify 0001.bmp
0001.bmp BMP3 5906x7200 5906x7200+0+0 8-bit sRGB 127.6MB 0.120u 0:00.129
$ opj_decompress -i 0001.jp2 -o 0001.bmp -r 0; identify 0001.bmp
0001.bmp BMP3 5906x7200 5906x7200+0+0 8-bit sRGB 127.6MB 0.120u 0:00.129
$ kdu_expand -quiet -i 0001.jp2 -o 0001.bmp -reduce 1; identify 0001.bmp
0001.bmp BMP3 2953x3600 2953x3600+0+0 8-bit sRGB 31.9MB 0.030u 0:00.040
$ opj_decompress -i 0001.jp2 -o 0001.bmp -r 1; identify 0001.bmp
0001.bmp BMP3 2953x3600 2953x3600+0+0 8-bit sRGB 31.9MB 0.030u 0:00.040
$ kdu_expand -quiet -i 0001.jp2 -o 0001.bmp -reduce 2; identify 0001.bmp
0001.bmp BMP3 1477x1800 1477x1800+0+0 8-bit sRGB 7.978MB 0.000u 0:00.000
$ opj_decompress -i 0001.jp2 -o 0001.bmp -r 2; identify 0001.bmp
0001.bmp BMP3 1477x1800 1477x1800+0+0 8-bit sRGB 7.978MB 0.010u 0:00.009
$ kdu_expand -quiet -i 0001.jp2 -o 0001.bmp -reduce 3; identify 0001.bmp
0001.bmp BMP3 739x900 739x900+0+0 8-bit sRGB 1.998MB 0.000u 0:00.000
$ opj_decompress -i 0001.jp2 -o 0001.bmp -r 3; identify 0001.bmp
0001.bmp BMP3 739x900 739x900+0+0 8-bit sRGB 1.998MB 0.000u 0:00.009
$ kdu_expand -quiet -i 0001.jp2 -o 0001.bmp -reduce 4; identify 0001.bmp
0001.bmp BMP3 370x450 370x450+0+0 8-bit sRGB 500KB 0.000u 0:00.000
$ opj_decompress -i 0001.jp2 -o 0001.bmp -r 4; identify 0001.bmp
0001.bmp BMP3 370x450 370x450+0+0 8-bit sRGB 500KB 0.000u 0:00.000
$ kdu_expand -quiet -i 0001.jp2 -o 0001.bmp -reduce 5; identify 0001.bmp
0001.bmp BMP3 185x225 185x225+0+0 8-bit sRGB 125KB 0.000u 0:00.000
$ opj_decompress -i 0001.jp2 -o 0001.bmp -r 5; identify 0001.bmp
0001.bmp BMP3 185x225 185x225+0+0 8-bit sRGB 125KB 0.000u 0:00.000
$ kdu_expand -quiet -i 0001.jp2 -o 0001.bmp -reduce 6; identify 0001.bmp
0001.bmp BMP3 93x113 93x113+0+0 8-bit sRGB 31.7KB 0.000u 0:00.000
$ opj_decompress -i 0001.jp2 -o 0001.bmp -r 6; identify 0001.bmp
0001.bmp BMP3 93x113 93x113+0+0 8-bit sRGB 31.7KB 0.000u 0:00.000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment