P4 Software P4 Software / BarcoderX English

Add these docs to Claude

Ask Claude questions about these docs. Claude reads the published pages and links you back to them. Copy this address:

https://docs.p4software.cloud/mcp

In claude.ai or Claude Desktop: open Settings, then Connectors, choose Add custom connector and paste the address.

In Claude Code, run:

claude mcp add --transport http docs https://docs.p4software.cloud/mcp

PNG output

PNG output

Applies to: BarcoderX Basic and Ultimate

Status: Built, not yet released. The PNG writer exists and is tested, but nothing is released yet and there is nothing to download. Turning a whole label into a PNG file needs the label engine, which is not built yet. This page says what the writer does today and what it does not do yet.

PNG is the picture format BarcoderX uses for previews, web pages and any other use where you need a picture of a label. See Output formats for the other formats. This page describes the PNG writer itself: the part that takes the pixels of a picture and writes a valid PNG file.

BarcoderX writes the PNG file with its own code. The only part it takes from .NET is the compression of the picture data.

What goes in

You give the writer the pixels of a picture, its width and height, and which kind of pixels they are. These kinds are accepted:

Kind of pictureWhat each pixel holds
Color with transparencyRed, green, blue and opacity, 8 bits each. Opacity is "straight": the color is not already multiplied by it. If your pixels are premultiplied, convert them first.
ColorRed, green and blue, 8 bits each.
GrayOne 8-bit value, 0 is black.
Black and white, 1 bitEight pixels to a byte, the leftmost pixel in the highest bit, each row padded to a whole byte. You can give it in either of two conventions: where 1 means black (the convention of a label bitmap), or where 1 means white (the convention of PNG itself). The file always follows the PNG convention.
PaletteAn 8-bit number for each pixel that points into a palette of 1 to 256 colors. Each palette color can have its own opacity. The writer stores the numbers at the smallest size that holds the palette: 1, 2, 4 or 8 bits.

What comes out

  • A normal PNG file that any viewer opens.
  • The file can record a resolution, in dots per inch, so a program that prints it knows its real size. If you give no resolution, the file records none.
  • You can choose the compression level, from 0 (stored, not compressed) to 9 (smallest). The default is 6.
  • You can choose how the rows of the picture are prepared before compression, or leave it on the automatic choice. The automatic choice follows the method that the PNG standard recommends.
  • Files are not interlaced.

Limits

BarcoderX checks every limit before it allocates any memory, so a picture that is too large is refused at once, not after the computer has run out of memory.

LimitValue
Pixels in one picture64,000,000 (64 million) by default. The program that calls the writer can set a different limit.
Width and heightAt least 1 and at most 2,147,483,647 each, as the PNG standard requires. The pixel limit is reached long before that.
Palette1 to 256 colors. A palette is allowed only with palette pictures, and every pixel must point to a color that is in it.
ResolutionA positive, finite number of dots per inch.
Length of the pixel dataMust match the width, height and kind of picture exactly.

A picture that breaks a limit is not written. The writer reports a clear reason, with a diagnostic code from 3100 to 3106. See Diagnostic codes. A running job can also be canceled between rows.

The same file on every platform, and what to compare

In BarcoderX's automatic tests, the PNG files for ten test cases are identical, byte for byte, on Windows x64, Linux x64 and Linux arm64. The cases use six pictures, five small ones and one of about 600 KB before compression, some of them at several compression levels.

Read this with care:

  • This was measured on one .NET release, not promised. The compression is done by .NET itself, and Microsoft does not promise that two .NET releases, or two kinds of processor, compress the same picture to the same bytes.
  • After a .NET update, the bytes of a PNG file can therefore change even though the picture has not. BarcoderX's code is the same, and the pixels in the file are the same.
  • To check that two files show the same picture, compare their pixels, not their bytes or a hash of the file. Open both, compare the decoded pixels, and treat them as equal if the pixels are equal.

The part that BarcoderX writes itself, the prepared rows before compression, is tested on every platform and does not depend on .NET.

What is not built yet

  • Reading PNG files. The writer only writes.
  • Making a PNG from a label. Layout, text, shapes and barcodes come together in the label engine, which is not built yet. See Drawing shapes for the drawing part that exists.
  • Interlaced PNG and other chunks such as text comments or color profiles.

BarcoderX is a product of P4 Software.

Was this page helpful?