{"record":{"id":"7c728aa93502c1c6","repo":"tauri-apps/tauri","slug":"icon-is-not-rgba","errorCode":null,"errorMessage":"icon {} is not RGBA","messagePattern":"icon (.+?) is not RGBA","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-codegen/src/image.rs","lineNumber":83,"sourceCode":"      cache,\n      root: root.clone(),\n      format: IconFormat::Image {\n        width: entry.width(),\n        height: entry.height(),\n      },\n    })\n  }\n\n  /// Cache a PNG icon as RGBA data, see [`ImageFormat::Image`].\n  pub fn new_png(root: &TokenStream, icon: &Path) -> EmbeddedAssetsResult<Self> {\n    let buf = Self::open(icon);\n    let decoder = png::Decoder::new(Cursor::new(&buf));\n    let mut reader = decoder\n      .read_info()\n      .unwrap_or_else(|e| panic!(\"failed to read icon {}: {}\", icon.display(), e));\n\n    if reader.output_color_type().0 != png::ColorType::Rgba {\n      panic!(\"icon {} is not RGBA\", icon.display());\n    }\n\n    let mut rgba = Vec::with_capacity(reader.output_buffer_size().unwrap());\n    while let Ok(Some(row)) = reader.next_row() {\n      rgba.extend(row.data());\n    }\n\n    Cached::try_from(rgba).map(|cache| Self {\n      cache,\n      root: root.clone(),\n      format: IconFormat::Image {\n        width: reader.info().width,\n        height: reader.info().height,\n      },\n    })\n  }\n\n  fn open(path: &Path) -> Vec<u8> {","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-codegen/src/image.rs#L65-L101","documentation":"new_png requires the PNG's output color type to be RGBA before embedding. If the decoded PNG uses another color type (RGB, grayscale, palette, etc.) the macro panics with `icon {path} is not RGBA`, because the embedded image is expected to carry premultiplied-free RGBA bytes.","triggerScenarios":"Embedding a PNG saved without an alpha channel (e.g. RGB 24-bit, grayscale, or indexed/palette PNG) through the icon macro path.","commonSituations":"Exporting icons from Photoshop/Figma without alpha; optimizing icons with tools that strip the alpha channel; downloading logos that are opaque RGB PNGs.","solutions":["Convert the PNG to 32-bit RGBA (e.g. `magick icon.png -define png:color-type=6 icon.png`)","Re-export from the design tool with transparency/alpha enabled","Use `pngcrush`/`oxipng` options that keep RGBA","If no alpha is needed, pre-composite onto a background and save as RGBA"],"exampleFix":"// before\nmagick icon.png -strip icon.png  // may output RGB\n// after\nmagick icon.png PNG32:icon.png  // forces 32-bit RGBA","handlingStrategy":"validation","validationCode":"from PIL import Image\nim = Image.open('icon.png')\nif im.mode not in ('RGBA', 'LA'):\n    Image.open('icon.png').convert('RGBA').save('icon.png')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always export icons with alpha (PNG32)","Normalize icons in CI: convert to RGBA before building","Avoid optimizers configured to strip alpha","Use `magick in.png PNG32:out.png` as the standard icon step"],"tags":["icon","png","rgba","color-type"],"backgroundTag":"invalid-argument-value","analyzedSha":"460ec35447493200d64290dd7f015d5a91d0fd58","analyzedAt":"2026-09-18T23:55:51.277Z","contentChangedAt":"2026-09-18T23:55:51.277Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}