# Convert PNG to Raw Pixel Buffer

Export PNG images as raw pixel buffer files for development workflows and low-level image processing.

> Canonical page: https://elysiatools.com/en/tools/png-to-raw

- **Category:** Media

- **Keywords:** png, raw, pixel, data, convert, image, binary, processing, camera-raw

## Overview

Write the decoded pixels from a PNG image into a headerless raw pixel buffer file. This output is useful for render pipelines, shaders, custom imaging code, and tools that expect width, height, channel count, and bit depth to be supplied separately. It does not generate a photographic camera RAW format such as DNG, CR2, NEF, or ARW.

## Inputs

- **PNG Image File** (file): Select PNG image to convert
- **Bit Depth** (select): Select bit depth for raw output
- **Premultiplied Alpha** (checkbox): Check for premultiplied alpha channel

## When to use

- When feeding raw image data directly into custom graphics shaders or GPU textures without parsing PNG headers.
- When developing low-level image processing algorithms that require uncompressed, sequential pixel arrays.
- When preparing asset pipelines for embedded systems or game engines that expect raw binary pixel buffers.

## How it works

- Upload a standard PNG image file from your local storage.
- Select the target bit depth of 8-bit or 16-bit per channel.
- Choose whether to apply premultiplied alpha to the color channels.
- Download the resulting headerless binary file containing the raw pixel buffer.

## Use cases

- Generating raw texture assets for custom game engines and WebGL applications.
- Preparing image datasets for machine learning models that ingest raw binary pixel arrays.
- Testing low-level image filtering and manipulation algorithms in C/C++ or Rust.

## Frequently asked questions

### Does this tool generate camera RAW formats like DNG or CR2?

No, it outputs a headerless binary buffer of raw pixel data, not a photographic camera RAW format.

### What color channels are included in the output buffer?

The output contains the decoded RGBA channels from the source PNG image in sequential order.

### What is the difference between 8-bit and 16-bit options?

The bit depth option determines whether each color channel is represented by 1 byte (8-bit) or 2 bytes (16-bit) in the output file.

### What does the premultiplied alpha option do?

It multiplies the RGB color values of each pixel by their corresponding alpha (transparency) value before exporting.

### How do I read the output file in my code?

Since the file is headerless, you must read the raw bytes directly using the original image's width, height, and channel count.

## Related tools

- [Convert Raw Pixel Buffer to PNG](https://elysiatools.com/en/tools/raw-to-png): Convert a headerless raw pixel buffer file to a PNG image. You must provide the image dimensions, channel count, and bit depth.
- [Convert ARW to PNG](https://elysiatools.com/en/tools/arw-to-png): Convert Sony ARW RAW files to PNG format. Automatically extracts image dimensions and metadata from the RAW file.
- [Convert CR2 to PNG](https://elysiatools.com/en/tools/cr2-to-png): Convert Canon CR2 RAW files to PNG format. Automatically extracts image dimensions and metadata from the RAW file.
- [Convert CR3 to PNG](https://elysiatools.com/en/tools/cr3-to-png): Convert Canon CR3 RAW files to PNG format. Automatically extracts image dimensions and metadata from the RAW file.
- [Convert CRW to PNG](https://elysiatools.com/en/tools/crw-to-png): Convert Canon CRW RAW files to PNG format. Automatically extracts image dimensions and metadata from the RAW file.
- [Convert DNG to PNG](https://elysiatools.com/en/tools/dng-to-png): Convert DNG (Digital Negative) RAW files to PNG format. Automatically extracts image dimensions and metadata from the RAW file.
- [Convert Leica RAW to PNG](https://elysiatools.com/en/tools/leica-raw-to-png): Convert Leica RAW files to PNG format. Automatically extracts image dimensions and metadata from the RAW file.
- [Convert NEF to PNG](https://elysiatools.com/en/tools/nef-to-png): Convert Nikon NEF RAW files to PNG format. Automatically extracts image dimensions and metadata from the RAW file.

## Samples

- [PNG Samples](https://elysiatools.com/en/samples/png-samples): Sample PNG images in different aspect ratios and resolutions
- [PNG Viewer Samples](https://elysiatools.com/en/samples/png-viewer-samples): Sample PNG, BMP and AVIF images for the in-browser PNG Viewer
- [Web Image Processing Python Samples](https://elysiatools.com/en/samples/web-image-processing-python): Web Python image processing examples using PIL/Pillow including reading, saving, resizing, and format conversion
- [Web Image Processing Go Samples](https://elysiatools.com/en/samples/web-image-processing-go): Web Go image processing examples including image reading/saving, image resizing, and format conversion
