diff options
Diffstat (limited to 'converter/other')
-rw-r--r-- | converter/other/pamtogif.c | 4 | ||||
-rw-r--r-- | converter/other/pamtopng.c | 15 |
2 files changed, 15 insertions, 4 deletions
diff --git a/converter/other/pamtogif.c b/converter/other/pamtogif.c index 8d432da1..185ad128 100644 --- a/converter/other/pamtogif.c +++ b/converter/other/pamtogif.c @@ -93,9 +93,9 @@ pamAlphaPlane(struct pam * const pamP) { if (streq(pamP->tuple_type, "RGB_ALPHA")) alphaPlane = 3; else if (streq(pamP->tuple_type, "GRAYSCALE_ALPHA")) - alphaPlane = 2; + alphaPlane = 1; else if (streq(pamP->tuple_type, "BLACKANDWHITE_ALPHA")) - alphaPlane = 2; + alphaPlane = 1; else alphaPlane = 0; diff --git a/converter/other/pamtopng.c b/converter/other/pamtopng.c index a323844f..761d303d 100644 --- a/converter/other/pamtopng.c +++ b/converter/other/pamtopng.c @@ -287,7 +287,17 @@ colorTypeFromInputType(const struct pam * const pamP) { pm_error("Input tuple type is GRAYSCALE, " "but number of planes is %u instead of 1", pamP->depth); - } else if (strneq(pamP->tuple_type, "BLACKANDWHITE", 3)) { + } else if (strneq(pamP->tuple_type, "BLACKANDWHITE_ALPHA", 19)) { + if (pamP->depth != 2) + pm_error("Input tuple type is BLACKANDWHITE_ALPHA, " + "but number of planes is %u instead of 2", + pamP->depth); + if (pamP->maxval != 1) + pm_error("Input tuple type is BLACKANDWHITE_ALPHA, " + "but maxval is %u instead of 1", (unsigned)pamP->maxval); + + retval = PNG_COLOR_TYPE_GRAY_ALPHA; + } else if (strneq(pamP->tuple_type, "BLACKANDWHITE", 13)) { if (pamP->depth != 1) pm_error("Input tuple type is BLACKANDWHITE, " "but number of planes is %u instead of 1", @@ -785,7 +795,8 @@ pngBitDepth(unsigned int const pnmBitDepth, unsigned int retval; if ((pngColorType == PNG_COLOR_TYPE_RGB || - pngColorType == PNG_COLOR_TYPE_RGB_ALPHA) && + pngColorType == PNG_COLOR_TYPE_RGB_ALPHA || + pngColorType == PNG_COLOR_TYPE_GRAY_ALPHA) && pnmBitDepth < 8) { retval = 8; |