Skip to content
This repository has been archived by the owner on Jul 16, 2019. It is now read-only.

stb_image_write.h

Roman Shapiro edited this page Jun 26, 2018 · 2 revisions

About

StbImageWrite.cs and StbImageWrite.Generated.cs contain ported code of the stb_image_write.h. It can write images in BMP, TGA, PNG, JPG and HDR formats.

Saving Image

Sample code for writing an image represented as RGBA byte array data:

using (Stream stream = File.OpenWrite(path))
{
	ImageWriter writer = new ImageWriter();
	Image image = new Image
	{
		Data = data,
		Width = width,
		Height = height,
		Comp = 4
	};
	writer.WritePng(image, stream);
}
Clone this wiki locally