{"record":{"id":"0e2f14fcec052660","repo":"Yalantis/uCrop","slug":"load-jxl-does-not-support-animated-jpeg-xl-s","errorCode":null,"errorMessage":"load_jxl(): Does not support animated JPEG XL '%s'.","messagePattern":"load_jxl\\(\\): Does not support animated JPEG XL '(.+?)'\\.","errorType":"exception","errorClass":"CImgIOException","httpStatus":null,"severity":"error","filePath":"ucrop/src/main/jni/CImg.h","lineNumber":57193,"sourceCode":"        JxlDecoderStatus status = JxlDecoderProcessInput(decoder);\n        if (status==JXL_DEC_SUCCESS || status==JXL_DEC_FULL_IMAGE) break;\n        else if (status==JXL_DEC_ERROR || status==JXL_DEC_NEED_MORE_INPUT) {\n          JxlDecoderDestroy(decoder);\n          throw CImgIOException(_cimg_instance\n                                \"load_jxl(): Failed to decode image '%s'.\",\n                                cimg_instance,\n                                nfilename);\n        } else if (status==JXL_DEC_BASIC_INFO) {\n          if (JXL_DEC_SUCCESS!=JxlDecoderGetBasicInfo(decoder,&jxlInfo)) {\n            JxlDecoderDestroy(decoder);\n            throw CImgIOException(_cimg_instance\n                                  \"load_jxl(): Failed to load image data '%s'.\",\n                                  cimg_instance,\n                                  nfilename);\n          }\n          if (jxlInfo.have_animation!=0) {\n            JxlDecoderDestroy(decoder);\n            throw CImgIOException(_cimg_instance\n                                  \"load_jxl(): Does not support animated JPEG XL '%s'.\",\n                                  cimg_instance,\n                                  nfilename);\n          }\n          hasAlpha = jxlInfo.alpha_bits!=0;\n          nChannels = hasAlpha?jxlInfo.num_color_channels + 1:jxlInfo.num_color_channels;\n          isGray = jxlInfo.num_color_channels==1;\n        } else if (status==JXL_DEC_NEED_IMAGE_OUT_BUFFER) {\n          std::size_t imgDataSize = 0;\n          format.num_channels = nChannels;\n          format.data_type = jxlInfo.bits_per_sample==16?JXL_TYPE_UINT16:JXL_TYPE_UINT8;\n          if (JXL_DEC_SUCCESS!=JxlDecoderImageOutBufferSize(decoder,&format,&imgDataSize)) {\n            JxlDecoderDestroy(decoder);\n            throw CImgIOException(_cimg_instance\n                                  \"load_jxl(): Failed to decode image data '%s'.\",\n                                  cimg_instance,\n                                  nfilename);\n          }","sourceCodeStart":57175,"sourceCodeEnd":57211,"githubUrl":"https://github.com/Yalantis/uCrop/blob/f788b534b48c144edf786c8cddbf0e029e637804/ucrop/src/main/jni/CImg.h#L57175-L57211","documentation":"load_jxl() only supports still images. If JxlBasicInfo.have_animation is non-zero, meaning the JXL file contains an animated sequence, the decoder is destroyed and this error is thrown. It is an explicit capability limitation, not a decode failure.","triggerScenarios":"load_jxl(filename) is called on a JPEG XL file whose basic info reports have_animation != 0 (animated JXL, e.g. exported from an animation tool).","commonSituations":"Users converting GIF/APNG/WebM content to JXL and expecting CImg to read it; bulk-processing a folder that contains both still and animated .jxl assets.","solutions":["Detect animated JXL beforehand and handle separately (extract a frame or reject).","Convert the animation to a still frame (first frame) with djxl/ffmpeg before loading.","If animation support is needed, use libjxl directly or another codec path (e.g. load_gif/WebP for animation)."],"exampleFix":"// before\nimg.load_jxl(anim.jxl); // throws: animated\n// after\n// ffmpeg -i anim.jxl -frames:v 1 frame.png\nimg.load_png(\"frame.png\");","handlingStrategy":"validation","validationCode":"bool jxlIsAnimated(const char* path) {\n  // animation flag is only knowable via basic info; pre-screen with a probe decoder\n  std::FILE* f = std::fopen(path, \"rb\");\n  if (!f) return false;\n  // lightweight heuristic: inspect JXL container metadata or decode with libjxl directly\n  std::fclose(f);\n  return probeHaveAnimation(path); // wraps JxlDecoderGetBasicInfo\n}","typeGuard":null,"tryCatchPattern":"try { img.load_jxl(path); } catch (CImgIOException& e) { if (strstr(e.what(), \"animated\")) useFirstFrameOnly(path); }","preventionTips":["Screen assets for animation flags during ingestion, not at load time","Convert animated JXL to still frames or video pipeline separately","Document that CImg load_jxl is stills-only for pipeline users"],"tags":["jxl","animation","unsupported-feature","cimg"],"backgroundTag":"unsupported-operation","analyzedSha":"f788b534b48c144edf786c8cddbf0e029e637804","analyzedAt":"2026-09-08T08:36:04.887Z","contentChangedAt":"2026-09-08T08:36:04.887Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}