Skip to content

Conversion

Ignacy edited this page Dec 26, 2024 · 1 revision

One interesting feature of the PixReader app is its ability to convert most popular image formats into PIX. How does it do this? Well, it's not as complicated as you may think.

After choosing an image, a GDI+ bitmap is creating using the System.Drawing.Bitmap class in C#. Then (on a background thread so the UI isn't lagged), every pixel of the bitmap is looped through. For each pixel, 2 things occur. First, the color of the pixel is read using the Bitmap.GetPixel() method. Second, the pixel's color is added to a System.Text.StringBuilder. Every time the end of a row in the bitmap is reached, a PIX nr code is added to the StringBuilder. Finally, a save location is chosen by the user, and the width and height of the PIX are written to the file, along with the StringBuilder (which contains all the color and new row codes).

And that's basically how PixReader converts images to PIX.

Getting started

Inner workings

Clone this wiki locally