{"record":{"id":"518b2fe696c04e83","repo":"Yalantis/uCrop","slug":"load-pandore-unknown-pixel-datatype-in-file-s","errorCode":null,"errorMessage":"load_pandore(): Unknown pixel datatype in file '%s'.","messagePattern":"load_pandore\\(\\): Unknown pixel datatype in file '(.+?)'\\.","errorType":"exception","errorClass":"CImgIOException","httpStatus":null,"severity":"error","filePath":"ucrop/src/main/jni/CImg.h","lineNumber":58837,"sourceCode":"                                \"encoded image dimensions (%d,%d,%d,%d).\",\\\n                                cimg_instance,\\\n                                (long)fsiz,filename?filename:\"(FILE*)\",\\\n                                (int)nwidth,(int)nheight,(int)ndepth,(int)ndim); \\\n        assign(nwidth,nheight,ndepth,ndim); \\\n        const size_t siz = size(); \\\n        stype *buffer = new stype[siz]; \\\n        cimg::fread(buffer,siz,nfile); \\\n        if (endian) cimg::invert_endianness(buffer,siz); \\\n        T *ptrd = _data; \\\n        cimg_foroff(*this,off) *(ptrd++) = (T)*(buffer++); \\\n        buffer-=siz; \\\n        delete[] buffer\n\n#define _cimg_load_pandore_case(nbdim,nwidth,nheight,ndepth,dim,stype1,stype2,stype3,ltype) { \\\n        if (sizeof(stype1)==ltype) { __cimg_load_pandore_case(nbdim,nwidth,nheight,ndepth,dim,stype1); } \\\n        else if (sizeof(stype2)==ltype) { __cimg_load_pandore_case(nbdim,nwidth,nheight,ndepth,dim,stype2); } \\\n        else if (sizeof(stype3)==ltype) { __cimg_load_pandore_case(nbdim,nwidth,nheight,ndepth,dim,stype3); } \\\n        else throw CImgIOException(_cimg_instance \\\n                                   \"load_pandore(): Unknown pixel datatype in file '%s'.\", \\\n                                   cimg_instance, \\\n                                   filename?filename:\"(FILE*)\"); }\n      if (!file && !filename)\n        throw CImgArgumentException(_cimg_instance\n                                    \"load_pandore(): Specified filename is (null).\",\n                                    cimg_instance);\n\n      const ulongT fsiz = file?(ulongT)cimg_max_buf_size:(ulongT)cimg::fsize(filename);\n      std::FILE *const nfile = file?file:cimg::fopen(filename,\"rb\");\n      CImg<charT> header(32);\n      cimg::fread(header._data,12,nfile);\n      if (cimg::strncasecmp(\"PANDORE\",header,7)) {\n        if (!file) cimg::fclose(nfile);\n        throw CImgIOException(_cimg_instance\n                              \"load_pandore(): PANDORE header not found in file '%s'.\",\n                              cimg_instance,\n                              filename?filename:\"(FILE*)\");","sourceCodeStart":58819,"sourceCodeEnd":58855,"githubUrl":"https://github.com/Yalantis/uCrop/blob/f788b534b48c144edf786c8cddbf0e029e637804/ucrop/src/main/jni/CImg.h#L58819-L58855","documentation":"The PANDORE loader dispatches on the header's declared pixel datatype, matching it against CImg's supported storage types (via sizeof checks in _cimg_load_pandore_case). If the type in the file matches none of the compiled-in alternatives, CImg throws CImgIOException. The file's header parsed fine, but its pixel encoding is not supported by this build.","triggerScenarios":"Loading a .pan file whose ID_type maps to a datatype width (e.g. long double, 64-bit int) that doesn't equal any of stype1/stype2/stype3 sizes in the compiled macro expansion.","commonSituations":"Files written with exotic or platform-dependent PANDORE types; 64-bit platform where sizeof(long) differs from the file's expectation; corrupt header bytes.","solutions":["Convert the file to a common PANDORE datatype (unsigned char, int, float) using the PANDORE tools before loading","Re-export from the source application with a standard type","Compare the header's datatype field with CImg's supported list and pick the right loader or convert with another library","Re-download the file if the header may be corrupted"],"exampleFix":"// before\nimg.load_pandore(\"exotic.pan\"); // throws: unsupported datatype\n// after\n// convert to float datatype with PANDORE tooling, then:\nimg.load_pandore(\"exotic_float.pan\");","handlingStrategy":"try-catch","validationCode":"// Inspect the PANDORE header datatype field before loading; skip unsupported widths.\nstd::ifstream f(path,std::ios::binary); char h[32]={}; f.read(h,32);\n// ensure datatype corresponds to 1/2/4-byte types supported by your CImg build","typeGuard":null,"tryCatchPattern":"try { img.load_pandore(path); } catch (const cimg_library::CImgIOException &e) { /* unsupported datatype */ convert_with_pandore_tools(path); }","preventionTips":["Standardize on common datatypes (unsigned char, int, float) when producing PANDORE files","Match the PANDORE library version that wrote the files to the CImg version you use","Test one representative file from each producer pipeline before batch processing"],"tags":["cimg","image-loading","pandore","unsupported-dtype"],"backgroundTag":"unsupported-dtype","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"}