unity resource_error ai_generated true

Failed to import asset: 'Assets/Textures/photo.cr2'. Error: Could not decode raw image data

ID: unity/asset-import-cr2-raw-not-supported

Also available as: JSON · Markdown · 中文
95%Fix Rate
90%Confidence
1Evidence
2023-11-12First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Unity 2021.3 active
Unity 2022.3 active
Unity 2023.2 active

Root Cause

Unity's texture importer does not support Canon CR2 raw image format; it expects standard formats like PNG, JPG, TGA, or EXR.

generic

中文

Unity的纹理导入器不支持佳能CR2原始图像格式;它期望标准格式如PNG、JPG、TGA或EXR。

Official Documentation

https://docs.unity3d.com/Manual/ImportingTextures.html

Workarounds

  1. 95% success Convert the CR2 file to a supported format (e.g., PNG, JPG, or EXR) using an external tool like Adobe Photoshop, GIMP, or ImageMagick. Command example: magick convert photo.cr2 photo.png
    Convert the CR2 file to a supported format (e.g., PNG, JPG, or EXR) using an external tool like Adobe Photoshop, GIMP, or ImageMagick. Command example: magick convert photo.cr2 photo.png
  2. 90% success If the raw image is needed for high-dynamic-range, convert to EXR or HDR format instead of PNG/JPG to preserve data.
    If the raw image is needed for high-dynamic-range, convert to EXR or HDR format instead of PNG/JPG to preserve data.
  3. 70% success Use a custom importer or script that loads the CR2 file via a third-party library (e.g., LibRaw) at runtime, bypassing Unity's import pipeline entirely.
    Use a custom importer or script that loads the CR2 file via a third-party library (e.g., LibRaw) at runtime, bypassing Unity's import pipeline entirely.

中文步骤

  1. 使用外部工具如Adobe Photoshop、GIMP或ImageMagick将CR2文件转换为支持的格式(如PNG、JPG或EXR)。命令示例:magick convert photo.cr2 photo.png
  2. 如果需要原始图像用于高动态范围,转换为EXR或HDR格式而不是PNG/JPG以保留数据。
  3. 使用自定义导入器或脚本,通过第三方库(如LibRaw)在运行时加载CR2文件,完全绕过Unity的导入管线。

Dead Ends

Common approaches that don't work:

  1. 98% fail

    Renaming does not change the internal file format; Unity will still attempt to decode the raw data and fail with a similar error.

  2. 90% fail

    Unity does not use system codecs for texture import; it relies on built-in decoders for supported formats only.

  3. 95% fail

    Re-saving in the same format does not change the encoding; Unity still cannot decode it.