# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/exact-image/hotfix-jasper.patch # Copyright (C) 2026 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- jp2_decode and jp2_encode are no longer exported by jasper, use jas_image_decode/encode with the jp2 format. --- exact-image-1.2.1.orig/codecs/jpeg2000.cc +++ exact-image-1.2.1/codecs/jpeg2000.cc @@ -30,6 +30,17 @@ #include "jpeg2000.hh" +// jp2_decode/jp2_encode are internal since jasper 3, use the format table +static int jp2_format() +{ + static bool initialized = false; + if (!initialized) { + jas_init(); + initialized = true; + } + return jas_image_strtofmt((char*)"jp2"); +} + static void add_color_prof(jas_image_t* image) { /* Create a color profile if needed. */ @@ -149,7 +160,7 @@ int JPEG2000Codec::readImage (std::istre jas_stream_initbuf (in); - if (!(image = jp2_decode(in, 0))) { + if (!(image = jas_image_decode(in, jp2_format(), 0))) { std::cerr << "error: cannot load image data" << std::endl; return false; } @@ -324,7 +335,7 @@ bool JPEG2000Codec::writeImage (std::ost std::stringstream opts; opts << "rate=" << (double)quality / 100; - jp2_encode(image, out, (char*)opts.str().c_str()); + jas_image_encode(image, out, jp2_format(), (char*)opts.str().c_str()); jas_image_destroy (image); jas_stream_close (out);