From ab9ce191707b23694b98d730fd28e8ddb940ec2b Mon Sep 17 00:00:00 2001
From: Kostya Shishkov <kostya.shishkov@gmail.com>
Date: Sat, 14 Oct 2006 12:23:54 +0000
Subject: [PATCH] Make PNG produce correct 8-bit pictures

Originally committed as revision 6689 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavcodec/png.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/png.c b/libavcodec/png.c
index 0dd9eaec23f..6d588c35a88 100644
--- a/libavcodec/png.c
+++ b/libavcodec/png.c
@@ -850,7 +850,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
         for(i = 0; i < 256; i++) {
             v = palette[i];
             alpha = v >> 24;
-            if (alpha != 0xff)
+            if (alpha && alpha != 0xff)
                 has_alpha = 1;
             *alpha_ptr++ = alpha;
             ptr[0] = v >> 16;
-- 
GitLab