Yalantis/uCrop · error · CImgIOException

load_pandore(): Unable to load data with ID_type %u in file

Error message

load_pandore(): Unable to load data with ID_type %u in file '%s'.

What it means

After parsing the PANDORE header, _load_pandore() switches on the object's ID_type to select a decoder branch. The default branch handles any ID_type this CImg version doesn't implement and throws CImgIOException including the numeric ID_type. The file is structurally valid PANDORE, but its object type (e.g. color images, graphs, 3D types) isn't supported here.

Source

Thrown at ucrop/src/main/jni/CImg.h:59010

      case 33 : _cimg_load_pandore_case(4,dims[3],dims[2],dims[1],dims[0],double,float,float,4); break;
      case 34 : { // Points 1D
        cimg::fread(ptbuf,1,nfile);
        if (endian) cimg::invert_endianness(ptbuf,1);
        assign(1); (*this)(0) = (T)ptbuf[0];
      } break;
      case 35 : { // Points 2D
        cimg::fread(ptbuf,2,nfile);
        if (endian) cimg::invert_endianness(ptbuf,2);
        assign(2); (*this)(0) = (T)ptbuf[1]; (*this)(1) = (T)ptbuf[0];
      } break;
      case 36 : { // Points 3D
        cimg::fread(ptbuf,3,nfile);
        if (endian) cimg::invert_endianness(ptbuf,3);
        assign(3); (*this)(0) = (T)ptbuf[2]; (*this)(1) = (T)ptbuf[1]; (*this)(2) = (T)ptbuf[0];
      } break;
      default :
        if (!file) cimg::fclose(nfile);
        throw CImgIOException(_cimg_instance
                              "load_pandore(): Unable to load data with ID_type %u in file '%s'.",
                              cimg_instance,
                              imageid,filename?filename:"(FILE*)");
      }
      if (!file) cimg::fclose(nfile);
      return *this;
    }

    //! Load image from a PAR-REC (Philips) file.
    /**
      \param filename Filename, as a C-string.
      \param axis Appending axis, if file contains multiple images. Can be <tt>{ 'x' | 'y' | 'z' | 'c' }</tt>.
      \param align Appending alignment.
    **/
    CImg<T>& load_parrec(const char *const filename, const char axis='c', const float align=0) {
      CImgList<T> list;
      list.load_parrec(filename);
      if (list._width==1) return list[0].move_to(*this);

View on GitHub (pinned to f788b534b4)

Solutions

  1. Convert the object to a supported image type (e.g. grayscale/RGB PanImage) with PANDORE tools (e.g. pextractplane, pconvert) before loading
  2. Upgrade CImg to a version whose switch covers your file's ID_type
  3. Load the file with the PANDORE library itself and export to a standard image format CImg can read
  4. Verify the ID_type is an image type at all — non-image PANDORE objects cannot be loaded as CImg images

Example fix

// before
img.load_pandore("new_version.pan"); // ID_type not handled
// after
// convert with PANDORE tooling to a classic image type, then:
system("pconvert new_version.pan out.pan");
img.load_pandore("out.pan");
Defensive patterns

Strategy: try-catch

Validate before calling

// Read the PANDORE header and check ID_type is one your CImg build supports before loading.
// If in doubt, pre-convert with PANDORE tools (pconvert) to a classic image type.

Try / catch

try { img.load_pandore(path); } catch (const cimg_library::CImgIOException &e) { // unsupported ID_type
  convert_with_pandore_tools(path); img.load_pandore(converted); }

Prevention

When it happens

Trigger: Loading a .pan file whose ID_type is a newer or non-image PANDORE object (newer format versions, graphs, multispectral data) that falls into the switch's default case.

Common situations: PANDORE files produced by newer versions of the PANDORE library than this CImg copy supports; non-image PANDORE objects (collections, graphs) passed to an image loader; misidentified file.

Related errors


AI-assisted analysis of Yalantis/uCrop@f788b534b4 (2026-09-08). Data as JSON: /api/errors/d3feef10f9a8362a. Report an issue: GitHub.