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 ImageMagick or GraphicsMagick only writes the first image slice.

What it means

Generic save_other() path: when neither native codecs nor a specific external wrapper applies, CImg shells out to ImageMagick or GraphicsMagick; for volumetric images (_depth>1) only the first slice reaches the external tool, so the rest of the volume is dropped. CImg warns via cimg::warn() and the save continues.

Source

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

       \param filename Filename, as a C-string.
       \param quality Image quality (expressed in percent), when the file format supports it.
       \note
       - The filename extension tells about the desired file format.
       - This method tries to save the instance image as a file, using external tools from
       <a href="http://www.imagemagick.org">ImageMagick</a> or
       <a href="http://www.graphicsmagick.org">GraphicsMagick</a>.
         At least one of these tool must be installed for the method to succeed.
       - It is recommended to use the generic method save(const char*, int) const instead,
         as it can handle some file formats natively.
    **/
    const CImg<T>& save_other(const char *const filename, const unsigned int quality=100) const {
      if (!filename)
        throw CImgArgumentException(_cimg_instance
                                    "save_other(): 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 "
                   "ImageMagick or GraphicsMagick only writes the first image slice.",
                   cimg_instance,filename);

      const unsigned int omode = cimg::exception_mode();
      bool is_saved = true;
      cimg::exception_mode(0);
      try { save_magick(filename); }
      catch (CImgException&) {
        try { save_imagemagick_external(filename,quality); }
        catch (CImgException&) {
          try { save_graphicsmagick_external(filename,quality); }
          catch (CImgException&) {
            is_saved = false;
          }
        }
      }
      cimg::exception_mode(omode);

View on GitHub (pinned to f788b534b4)

Solutions

  1. Compile with the appropriate cimg_use_* macro so the native in-process codec handles the format
  2. Iterate slices and save each one separately
  3. Use save_cimg() or save_tiff() for volumetric data
  4. Verify image dimensions: fix constructor argument order if depth>1 is unintended (CImg(w,h,1,c))

Example fix

// before
volume.save("out.bmp");             // external tool fallback, only slice 0
// after
for (int z = 0; z < volume.depth(); ++z)
  volume.get_slice(z).save_bmp(cimg::format("out_%03d.bmp", 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.bmp", z));
else
  img.save("out.bmp");

Type guard

bool is_2d(const cimg_library::CImg<T>& img) { return img.depth() == 1; }

Try / catch

try { img.save("out.bmp"); } catch (CImgException& e) { /* handle */ }

Prevention

When it happens

Trigger: Calling save_other() (or save() with a format resolved to save_other) on an image with _depth>1 when CImg has no native codec for the extension and falls back to the external ImageMagick/GraphicsMagick binary.

Common situations: Saving multi-slice data to formats like BMP/GIF/JPEG on builds without cimg_use_* flags; environments where only command-line ImageMagick is available; misconstructed images with accidental depth dimension.

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


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