Yalantis/uCrop · error · CImgArgumentException
CImgDisplay::render(): Empty specified image.
Error message
CImgDisplay::render(): Empty specified image.
What it means
Thrown by CImgDisplay::render() when the image to be rendered into the display's frame buffer is empty (no pixel data). The library deliberately rejects empty images rather than painting nothing, since rendering an empty buffer leaves the window in an undefined visual state. Ensure the image was successfully loaded or assigned before rendering.
Solutions
- Ensure the image is initialized and has non-zero width/height before calling render()
- Test with img.is_empty() and skip or fill the image first if it is empty
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at ucrop/src/main/jni/CImg.h:10872 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Yalantis/uCrop@f788b534b4 (2026-09-08).
Data as JSON: /api/errors/b2c9b4c6ee19a73a.
Report an issue: GitHub.
Appendix: source
Thrown at ucrop/src/main/jni/CImg.h:10872
"display(): Empty specified image.",
cimgdisplay_instance);
if (is_empty()) return assign(img);
return render(img).paint(false);
}
CImgDisplay& paint(const bool wait_expose=true) {
if (is_empty()) return *this;
cimg::X11_attr &X11_attr = cimg::X11_attr::ref();
X11_attr.lock();
_paint(wait_expose);
X11_attr.unlock();
return *this;
}
template<typename T>
CImgDisplay& render(const CImg<T>& img, const bool flag8=false) {
if (!img)
throw CImgArgumentException(_cimgdisplay_instance
"render(): Empty specified image.",
cimgdisplay_instance);
if (is_empty()) return *this;
if (img._depth!=1) return render(img.get_projections2d((img._width - 1)/2,(img._height - 1)/2,
(img._depth - 1)/2));
cimg::X11_attr &X11_attr = cimg::X11_attr::ref();
if (X11_attr.nb_bits==8 && (img._width!=_width || img._height!=_height))
return render(img.get_resize(_width,_height,1,-100,1));
if (X11_attr.nb_bits==8 && !flag8 && img._spectrum==3) {
static const CImg<typename CImg<T>::ucharT> default_colormap = CImg<typename CImg<T>::ucharT>::default_LUT256();
return render(img.get_index(default_colormap,1,false));
}
const T
*data1 = img._data,
*data2 = (img._spectrum>1)?img.data(0,0,0,1):data1,
*data3 = (img._spectrum>2)?img.data(0,0,0,2):data1;View on GitHub (pinned to f788b534b4)