PNG to BGRA Converter

Decodes an uploaded PNG onto a canvas and downloads its pixels as a raw blue-green-red-alpha byte dump with no header — the layout Windows GDI/DirectX, some BMP variants, and certain GPU texture formats expect. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-26

Overview

Introduction

This tool exports a PNG's full pixel data, including transparency, as a raw BGRA byte dump entirely in your browser, matching the blue-first channel order many native and Windows graphics pipelines expect.

Nothing leaves your device; decoding and channel reordering both happen on an off-screen canvas.

What Is PNG to BGRA Converter?

A client-side PNG-to-raw-BGRA converter that reads an uploaded PNG's decoded pixels and writes each one as 4 bytes in blue, green, red, alpha order.

The output has no header — it matches the per-pixel layout of formats like Windows' 32-bit DIB or a `B8G8R8A8` GPU texture format.

How PNG to BGRA Converter Works

The upload panel decodes the PNG into a plain RGBA pixel buffer via canvas, then this tool's pure function walks every pixel, writing blue, green, red, and alpha (in that order) into a new buffer.

The resulting byte array is offered as a direct download with no compression, chunk structure, or metadata around it.

When To Use PNG to BGRA Converter

Use it when feeding pixel data into a Windows GDI/DirectX pipeline, a `B8G8R8A8`-format GPU texture, or any format documented as expecting BGRA channel order with alpha.

It's also useful for debugging color-swap issues where you need a known-BGRA reference file.

Features

Advantages

  • Runs entirely client-side; your image never leaves the browser.
  • Matches the exact byte order many native Windows and GPU imaging pipelines require.
  • Preserves the alpha channel exactly, unlike the BGR (3-byte) variant.

Limitations

  • The output file stores no dimensions, so width and height must be tracked separately.
  • File size is 33% larger than the BGR equivalent for the same image, since every pixel carries an extra alpha byte.

Examples

Prepare a texture for a DirectX pipeline

Input

A 32x32 PNG with soft, semi-transparent edges

Output

A 4,096-byte (32 x 32 x 4) raw BGRA buffer

Many DirectX surface formats expect exactly this blue-first, alpha-last byte order by default.

Debug a color-swap issue with alpha

Input

A semi-transparent red test-pattern PNG

Output

A BGRA dump whose first byte per pixel is 0 (blue) rather than 255 (red), with the alpha byte matching the source

Comparing this against an RGBA export makes a channel-order bug immediately visible even when alpha is involved.

Best Practices & Notes

Best Practices

  • Record the source image's width and height before downloading, since the raw file doesn't store them.
  • Double-check whether your target library truly expects BGRA — many web and mobile APIs use RGBA instead.

Developer Notes

The pure conversion loop lives in a lib function that operates on a plain PixelBuffer and returns a Uint8Array with no DOM dependency, reading the RGBA source 4 bytes at a time and writing blue/green/red/alpha (4 bytes) at a time to the output.

PNG to BGRA Converter Use Cases

  • Feeding pixel data into a Windows GDI/DirectX imaging pipeline
  • Producing test fixtures for BGRA-vs-RGBA channel-order bugs
  • Preparing raw pixel data for a GPU texture format expecting BGRA with alpha

Common Mistakes

  • Using this when the target actually expects RGBA order, producing visibly swapped red/blue colors.
  • Forgetting to record width/height, making the raw bytes impossible to reinterpret later.

Tips

  • Pair this with the matching BGRA to PNG converter to verify a round trip reproduces the original pixels exactly, including alpha.
  • If you don't need alpha, the smaller PNG to BGR converter produces a 25% smaller file.

References

Frequently Asked Questions