Support reducing png bit depth

This commit is contained in:
GriffinR 2023-01-11 10:11:11 -05:00
parent 6d6a876dbd
commit 3ee3d6e346

View File

@ -62,10 +62,7 @@ static unsigned char *ConvertBitDepth(unsigned char *src, int srcBitDepth, int d
for (j = 8 - srcBitDepth; j >= 0; j -= srcBitDepth)
{
unsigned char pixel = (srcByte >> j) % (1 << srcBitDepth);
if (pixel >= (1 << destBitDepth))
FATAL_ERROR("Image exceeds the maximum color value for a %ibpp image.\n", destBitDepth);
unsigned char pixel = (srcByte >> j) % (1 << destBitDepth);
*dest |= pixel << destBit;
destBit -= destBitDepth;
if (destBit < 0)