Instantly share code, notes, and snippets.

Embed
What would you like to do?
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