{"record":{"id":"f7adbaf102e55964","repo":"stride3d/stride","slug":"the-pixel-format-format-is-not-supported-supported-formats","errorCode":null,"errorMessage":"The pixel format {format} is not supported. Supported formats are {PixelFormat.B8G8R8A8_UNorm}, {PixelFormat.B8G8R8A8_UNorm_SRgb}, {PixelFormat.R8G8B8A8_UNorm}, {PixelFormat.R8G8B8A8_UNorm_SRgb}, {PixelFormat.R8_UNorm}, and {PixelFormat.A8_UNorm}","messagePattern":"The pixel format (.+?) is not supported\\. Supported formats are (.+?), (.+?), (.+?), (.+?), (.+?), and (.+?)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Foundation/Graphics/StandardImageHelper.cs","lineNumber":105,"sourceCode":"                }\n            }\n        }\n        else if (format is PixelFormat.R8_UNorm or PixelFormat.A8_UNorm)\n        {\n            // SpriteBatch only renders RGBA, so expand single-channel grey into RGB with opaque alpha.\n            for (int y = 0; y < height; y++)\n            {\n                var srcRow = src + y * srcStride;\n                for (int x = 0; x < width; x++)\n                {\n                    byte g = srcRow[x];\n                    pixels[y * width + x] = new Rgba32(g, g, g, (byte)255);\n                }\n            }\n        }\n        else\n        {\n            throw new ArgumentException(\n                $\"The pixel format {format} is not supported. Supported formats are {PixelFormat.B8G8R8A8_UNorm}, {PixelFormat.B8G8R8A8_UNorm_SRgb}, {PixelFormat.R8G8B8A8_UNorm}, {PixelFormat.R8G8B8A8_UNorm_SRgb}, {PixelFormat.R8_UNorm}, and {PixelFormat.A8_UNorm}\",\n                nameof(description));\n        }\n\n        return SharpImage.LoadPixelData<Rgba32>(pixels, width, height);\n    }\n\n\n    /// <summary>\n    ///   Copies a block of memory from a source buffer to a destination buffer,\n    ///   converting each 32-bit pixel from RGBA to BGRA format.\n    /// </summary>\n    /// <param name=\"dest\">A pointer to the destination buffer that will receive the converted BGRA pixel data.</param>\n    /// <param name=\"src\">A pointer to the source buffer containing the RGBA pixel data to copy and convert.</param>\n    /// <param name=\"sizeInBytesToCopy\">\n    ///   The number of bytes to copy and convert. Must be a multiple of 4, as each pixel is represented by 4 bytes.\n    /// </param>\n    /// <exception cref=\"ArgumentException\"><paramref name=\"sizeInBytesToCopy\"/> is not a multiple of 4.</exception>","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Foundation/Graphics/StandardImageHelper.cs#L87-L123","documentation":"StandardImageHelper.CreateImage only knows how to synthesize pixel data for a small fixed set of formats: B8G8R8A8_UNorm(_SRgb), R8G8B8A8_UNorm(_SRgb), R8_UNorm, and A8_UNorm. Any other PixelFormat in the description falls through to a throw of ArgumentException naming the unsupported format and the full supported list.","triggerScenarios":"Calling image(description) / StandardImageHelper.CreateImage with an ImageDescription whose Format is outside the supported set — e.g. R16G16B16A16_Float, BC-compressed, or 3-byte RGB formats.","commonSituations":"Procedurally generated or test images using float/half formats; loading DDS assets with block-compressed formats through the standard helper; changing a texture asset's format to HDR and rerunning the same load path.","solutions":["Change the image description's format to one of the supported list (prefer R8G8B8A8_UNorm).","Convert the source asset to an 8-bit RGBA/gray/alpha format before loading.","Use a loader that supports the target format (e.g. DDS-aware path) instead of StandardImageHelper."],"exampleFix":"// before\ndescription.Format = PixelFormat.R16G16B16A16_Float;\nvar img = image(description);\n// after\ndescription.Format = PixelFormat.R8G8B8A8_UNorm;\nvar img = image(description);","handlingStrategy":"validation","validationCode":"static readonly PixelFormat[] Supported =\n{\n    PixelFormat.B8G8R8A8_UNorm, PixelFormat.B8G8R8A8_UNorm_SRgb,\n    PixelFormat.R8G8B8A8_UNorm, PixelFormat.R8G8B8A8_UNorm_SRgb,\n    PixelFormat.R8_UNorm, PixelFormat.A8_UNorm\n};\nif (!Supported.Contains(description.Format))\n    throw new ArgumentException($\"{description.Format} unsupported by StandardImageHelper\");","typeGuard":"bool IsStandardHelperFormat(PixelFormat f) =>\n    f == PixelFormat.B8G8R8A8_UNorm || f == PixelFormat.B8G8R8A8_UNorm_SRgb ||\n    f == PixelFormat.R8G8B8A8_UNorm || f == PixelFormat.R8G8B8A8_UNorm_SRgb ||\n    f == PixelFormat.R8_UNorm || f == PixelFormat.A8_UNorm;","tryCatchPattern":"try { img = image(description); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"pixel format\")) { description.Format = PixelFormat.R8G8B8A8_UNorm; img = image(description); }","preventionTips":["Normalize all procedural/test image formats to R8G8B8A8_UNorm before calling the helper.","Keep the supported-format list checked against the helper version when upgrading Stride.","Route compressed/HDR formats to a loader that supports them."],"tags":["graphics","image-loading","pixel-format","unsupported"],"backgroundTag":"unsupported-enum-value","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}