Prevent PNG Encoder from adding Gamma information to a 1-bit PNG

Hello,

 

I wonder if its possible to instruct the Imaging PNG Encoder not to add any gamma and chroma informations to a 1-bit PNG.

I am creating a 2 color palette for the image

ColorPalette* pal = (ColorPalette*)CoTaskMemAlloc(sizeof(ColorPalette) + 2 * sizeof(ARGB));
    pal->Count = 2;
    pal->Flags = 0;
    pal->Entries[0] = MAKEARGB(0,0,0,0);
    pal->Entries[1] = MAKEARGB(0,255,255,255);
    if (FAILED(res = sink->SetPalette(pal))) {
      return res;
    }
    CoTaskMemFree(pal);

 

and then just

 

BitmapData bmData;
    bmData.Height = bm.bmHeight;
    bmData.Width = bm.bmWidth;
    bmData.Scan0 = bm.bmBits;
    bmData.PixelFormat = PixelFormat1bppIndexed;

    UINT bitsPerLine = imageInfo.Width * bm.bmBitsPixel;
    UINT bitAlignment = sizeof(LONG) * 8;
    UINT bitStride = bitAlignment * (bitsPerLine / bitAlignment);    // The image buffer is always padded to LONG boundaries
    if ((bitsPerLine % bitAlignment) != 0) bitStride += bitAlignment; // Add a bit more for the leftover values
    bmData.Stride = bitStride / 8;

    if (FAILED(res = sink->PushPixelData(&rect, &bmData, TRUE))) {
      return res;
    }

The resulting PNG image is way to large and contains the following useless headers:

sRGB,gAMA,cHRM

 

I was actually only expecting PLTE not sRGB. How do I have to setup the encoder to skip gamma and chroma calculations?

 

Thanks

Phil