static Image ProcessExtraSamples(ZDeflaterOutputStream zip, ZDeflaterOutputStream mzip, byte[] outBuf, int samplePerPixel, int bitsPerSample, int width, int height)
{
if (bitsPerSample == 8) {
byte[] mask = new byte[width * height];
int mptr = 0;
int optr = 0;
int total = width * height * samplePerPixel;
for (int k = 0; k < total; k += samplePerPixel) {
for (int s = 0; s < samplePerPixel - 1; ++s) {
outBuf[optr++] = outBuf[k + s];
}
mask[mptr++] = outBuf[k + samplePerPixel - 1];
}
zip.Write(outBuf, 0, optr);
mzip.Write(mask, 0, mptr);
}
else
throw new ArgumentException(MessageLocalization.GetComposedMessage("extra.samples.are.not.supported"));
return null;
}