bevyengine/bevy · error · CompressedImageSaverError

Cannot compress an sRGB texture ({0:?}) as a normal map; the

Error message

Cannot compress an sRGB texture ({0:?}) as a normal map; the input Image's texture_descriptor.format must be a non-sRGB (linear) variant

What it means

CompressedImageSaverError normal-map variant: saving as a normal map requires linear data, but the image's texture format is an sRGB variant, which would corrupt normals if compressed as-is.

Source

Thrown at crates/bevy_image/src/compressed_image_saver/mod.rs:220

#[non_exhaustive]
#[derive(Debug, Error, TypePath)]
pub enum CompressedImageSaverError {
    /// I/O error.
    #[error(transparent)]
    Io(#[from] std::io::Error),
    /// The underlying compression library returned an error.
    #[error(transparent)]
    CompressionFailed(Box<dyn core::error::Error + Send + Sync>),
    /// Attempted to save an image with uninitialized data.
    #[error("Cannot compress an uninitialized image")]
    UninitializedImage,
    /// The texture format is not supported for compression.
    #[error("Unsupported texture format for compression: {0:?}")]
    UnsupportedFormat(TextureFormat),
    /// `is_normal_map` was set, but the input [`Image`]'s `texture_descriptor.format` is an sRGB
    /// variant (e.g. `Rgba8UnormSrgb`). Normal maps must be stored as linear vector data. Typically this means
    /// configuring the [`ImageLoaderSettings`] with `is_srgb: false` for this image.
    #[error(
        "Cannot compress an sRGB texture ({0:?}) as a normal map; \
         the input Image's texture_descriptor.format must be a non-sRGB (linear) variant"
    )]
    NormalMapMustBeLinear(TextureFormat),
}

View on GitHub (pinned to 396ca72708)

Solutions

  1. Change the image's texture_descriptor.format to the linear (non-sRGB) counterpart before saving
  2. Load/generate normal maps with linear formats
  3. Don't mark the asset as a normal map if it is genuinely sRGB color data
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/bevy_image/src/compressed_image_saver/mod.rs:220 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of bevyengine/bevy@396ca72708 (2026-08-20). Data as JSON: /api/errors/c0f30277d12fbefa. Report an issue: GitHub.