Closed jcupitt closed 5 months ago
Test with eg.:
$ time vips kakadusave k2.jpg x.jp2 --options Creversible=yes
real 0m0.091s
user 0m0.462s
sys 0m0.020s
$ time vips kakadusave k2.jpg x.jph --options Creversible=yes
real 0m0.080s
user 0m0.090s
sys 0m0.037s
$ ls -l x.jp2 x.jph
-rw-r--r-- 1 john john 2447603 Mar 5 18:29 x.jp2
-rw-r--r-- 1 john john 2681043 Mar 5 18:29 x.jph
You can see there's a dramatic drop in user
time, and the file size is slightly larger.
The option is enabled automatically for filenames with a .jph
suffix, or you can set the htj2k
option if there's no filename available.
data = image.kakadusave_buffer(htj2k=True)
pyvips is still not detecting the extension:
>>> from pyvips import Image
>>> img = Image.new_from_file("x.jph")
>>> img.get("vips-loader")
'jp2kload'
>>> with open("x.jph", "rb") as fh:
... img = Image.new_from_buffer(fh.read(), options="")
...
>>> img.get("vips-loader")
'jp2kload_buffer'
Shouldn't the loader be kakaduload
and kakaduload_buffer
respectively?
The kakadu loader and saver don't take over libvips jpeg2000 handling, you have to invoke them explicitly with kakaduload
and kakadusave
.
OK, got it. My impression was that they would (as OPJ does, or doesn't it either?)
In either case it's not a big deal, I'll just add a fallback option.
Could you please look into the merge conflicts? I think I could resolve them but I'd rather rely on your judgment.
We could make them take over all jpeg2000 handling, but that should probably be another PR.
That would be ideal, thanks.
to enable high-throughput j2k
see https://github.com/harvard-lts/kakadu-vips/issues/6