colors

extract colors from pictures
git clone git://git.2f30.org/colors
Log | Files | Refs | README | LICENSE

commit d2660bf89da280e85ebb114f2e85845486e9d1e9
parent 5a37247704d4cbfc185088dff8453e81fb6f7733
Author: sin <sin@2f30.org>
Date:   Sat,  6 Jun 2015 09:54:07 +0100

Skip pixels with a zero alpha component

Diffstat:
Mpng.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/png.c b/png.c @@ -36,6 +36,8 @@ parseimg(char *f, void (*fn)(int, int, int)) png_byte *row = png_row_p[y]; for (x = 0; x < width; x++) { png_byte *p = &row[x * 4]; + if (color == PNG_COLOR_TYPE_RGB_ALPHA && !p[3]) + continue; fn(p[0], p[1], p[2]); } }