Closed jcupitt closed 7 months ago
The simple_example_c
demo application and our kakadusave
give approximately the same result.
@palemieux, could I ping you on this too? Sorry to ask such a basic question.
I will test this later tonight and get back to you.
I tried rebuilding without HTJP2K and has the same result. I tried Clayers=3 -num_threads 1
, same result again.
I get the same exact info output and the same botched image with your parameters (Qfactor=85 Clayers=5
). Also without parameters I get a different but similarly botched result.
The same happens with a TIFF and a JPEG. I suspect something is wrong with the latest version of kdu_compress at this point. I will try compiling 8.3 and trying again.
If there's an error, it's probably deeper in the library, all the kakadu compress programs I've tried make images like this.
Which Kakadu version are you testing with?
I'm using v8_3-02172N.zip
I compiled v8_3-02108C and tried again, with the same results. There must be something else because that is the version we have in our production image servers.
Could you confirm that the kdu_compress
command works with your production servers?
./kdu_compress -i ~/pics/sample_640×426.ppm -o x.jp2 Qfactor=85 Clayers=3
If it does, then I suppose it must be something dumb about the way I've built it.
Your command produces a corrupted image in the Docker container that we are using in our production servers.
The same command on the same image outputs a valid JP2 on Mac OSX (silicon).
On the other hand, the command we are using in production to produce HTJ2K produces a valid HTJ2K:
kdu_compress -i /data/sample1.ppm -o /data/sample1.jp2 -rate 3 Qfactor=90 Cmodes=HT ORGgen_plt=yes Creversible=no ORGtparts=R ORGgen_tlm=9
At this point I'll have to involve the Kakadu developers. But in the meantime, can you test kakadu-vips with the above command (for HTJ2K) until we get this clarified?
(^^ FYI I corrected a typo: it's -rate 3
not -rate 2
)
Using KDU 8.4.1
kdu_compress -i sample_640_426.ppm -o x.jp2 Qfactor=85 Clayers=5
kdu_expand -i x.jp2 -o x.ppm
results in a PPM file that looks right in GIMP.
@palemieux which OS/arch?
I did a quick VS 2019 compile on Windows 11.
It could be a specific arch issue. 8.4. also works for me on OSX/ARM.
I'll try 8.4.1 here.
Works for me on Ubuntu 20 x64 intel
@palemieux did you use the default options for compiling? And did you use the make/Makefile-Linux-x86-64-gcc
or the individual ones in the coresys
and managed
directories?
It might sound like a stretch but I'm trying to find out what is different between our runtime environments.
mv srclib_ht/ srclib_noht/
mv altlib_ht_opt/ srclib_ht/
cd make
make CXXFLAGS=-DFBC_ENABLED -f Makefile-Linux -x86-64-gcc all_but_jni
cd ../bin/Linux-x86-64-gcc/
LD_LIBRARY_PATH=../../lib/Linux-x86-64-gcc/ ./kdu_compress -i /mnt/c/Users/pal/Documents/sample_640_426.ppm -o /mnt/c/Users/pal/Documents/x.jp2 Qfactor=85 Clayers=5
8.4.1 is working for me (ubuntu 23.10)!
I suppose this is an 8.3 bug, I'll close.
Strange, I thought I saw it in 8.4 too. I'll investigate further. But at least you can go ahead with your testing.
Thanks for checking in, @palemieux .
kakadusave
seems to more or less work now, but it's not round-tripping correctly, and I'm not sure why. Can I ping you on this @scossu ?I tried with this sample PPM file (just to be certain my input file was OK):
https://filesamples.com/samples/image/ppm/sample_640%C3%97426.ppm
It looks like this as a JPEG:
I tried encoding it like this (about the simplest example in the kakadu docs):
But the image I get is almost unrecognisable decoded with openjpeg. I see:
To make:
I tried decoding with kakadu:
But the result is bad again:
At least kakadu and openjpeg decode mostly agree heh. Did I get the encode command right? Have I perhaps built kakadu incorrectly?