file-png: Get num_colors properly before passing it on

This commit is contained in:
Mukund Sivaraman 2011-04-26 15:18:27 +05:30
parent 838ba0b78e
commit 5b5d88a2f1

View file

@ -1230,6 +1230,7 @@ save_image (const gchar *filename,
struct tm *gmt; /* GMT broken down */ struct tm *gmt; /* GMT broken down */
int color_type; int color_type;
int bit_depth; int bit_depth;
png_colorp palette;
guchar remap[256]; /* Re-mapping for the palette */ guchar remap[256]; /* Re-mapping for the palette */
@ -1354,9 +1355,8 @@ save_image (const gchar *filename,
case GIMP_INDEXED_IMAGE: case GIMP_INDEXED_IMAGE:
bpp = 1; bpp = 1;
color_type = PNG_COLOR_TYPE_PALETTE; color_type = PNG_COLOR_TYPE_PALETTE;
png_set_PLTE (pp, info, palette = (png_colorp) gimp_image_get_colormap (image_ID, &num_colors);
(png_colorp) gimp_image_get_colormap (image_ID, &num_colors), png_set_PLTE (pp, info, palette, num_colors);
num_colors);
bit_depth = get_bit_depth_for_palette (num_colors); bit_depth = get_bit_depth_for_palette (num_colors);
break; break;