Yalantis/uCrop · warning
save_other(): File '%s', saving a volumetric image with an e
Error message
save_other(): File '%s', saving a volumetric image with an external call to GraphicsMagick only writes the first image slice.
What it means
When saving via an external GraphicsMagick process (save_graphicsmagick_external, called from save_other), CImg warns that volumetric images (_depth>1) are truncated to the first slice because the external command-line tool receives a temporary flat image file. Non-fatal; slices beyond z=0 are lost silently after the warning.
Source
Thrown at ucrop/src/main/jni/CImg.h:63718
return *this;
}
//! Save image using GraphicsMagick's external binary.
/**
\param filename Filename, as a C-string.
\param quality Image quality (expressed in percent), when the file format supports it.
\note This method uses \c gm, an external executable binary provided by
<a href="http://www.graphicsmagick.org">GraphicsMagick</a>.
It must be installed for the method to succeed.
**/
const CImg<T>& save_graphicsmagick_external(const char *const filename, const unsigned int quality=100) const {
if (!filename)
throw CImgArgumentException(_cimg_instance
"save_graphicsmagick_external(): Specified filename is (null).",
cimg_instance);
if (is_empty()) { cimg::fempty(0,filename); return *this; }
if (_depth>1)
cimg::warn(_cimg_instance
"save_other(): File '%s', saving a volumetric image with an external call to "
"GraphicsMagick only writes the first image slice.",
cimg_instance,filename);
#ifdef cimg_use_png
#define _cimg_sge_extension1 "png"
#define _cimg_sge_extension2 "png"
#else
#define _cimg_sge_extension1 "pgm"
#define _cimg_sge_extension2 "ppm"
#endif
CImg<charT> command(1024), filename_tmp(256);
do {
cimg_snprintf(filename_tmp,filename_tmp._width,"%s%c%s.%s",
cimg::temporary_path(),cimg_file_separator,cimg::filenamerand(),
_spectrum==1?_cimg_sge_extension1:_cimg_sge_extension2);
} while (cimg::path_exists(filename_tmp));
View on GitHub (pinned to f788b534b4)
Solutions
- Compile CImg with the native codec macro for the target format (e.g. cimg_use_png, cimg_use_jpeg) so save_other uses the in-process codec
- Save slices individually before delegating to the external tool
- Use save_cimg() (native CImg format) for volumetric data
- Install GraphicsMagick with multi-page support and switch to formats like TIFF/MIFF if volume support is needed
Example fix
// before
volume.save_other("out.png"); // external gm, only slice 0
// after
for (int z = 0; z < volume.depth(); ++z)
volume.get_slice(z).save_png(cimg::format("out_%03d.png", z)); Defensive patterns
Strategy: validation
Validate before calling
if (img.depth() > 1)
for (int z = 0; z < img.depth(); ++z) img.get_slice(z).save(cimg::format("out_%03d.png", z));
else
img.save("out.png"); Type guard
bool is_2d(const cimg_library::CImg<T>& img) { return img.depth() == 1; } Try / catch
try { img.save("out.png"); } catch (CImgException& e) { /* handle */ } Prevention
- Build CImg with native codec macros (cimg_use_png, cimg_use_tiff) to avoid external-tool fallbacks
- Slice volumetric data before external-tool saves
- Check whether gm/convert binaries are being used (verbose logs) in production
When it happens
Trigger: Calling save_other()/save_graphicsmagick_external() with _depth>1 when no native codec is compiled in for the target format (no cimg_use_png etc.), so CImg shells out to the 'gm convert' binary.
Common situations: Build without cimg_use_* flags forcing external-tool fallbacks; saving 3D data to PNG/JPEG via GraphicsMagick; CI/Docker images lacking native codec libraries.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- save_other(): File '%s', saving a volumetric image with an e
- save_other(): File '%s', saving a volumetric image with an e
- load_graphicsmagick_external(): Failed to load file '%s' wit
- save_graphicsmagick_external(): Specified filename is (null)
- save_pfm(): Instance is volumetric, only the first slice wil
AI-assisted analysis of Yalantis/uCrop@f788b534b4 (2026-09-08).
Data as JSON: /api/errors/f1e0f4573d0acbf7.
Report an issue: GitHub.