638
640
/* set the palette if there is one. REQUIRED for indexed-color images */
639
641
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH
641
643
/* ... set palette colors ... */
642
644
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
643
645
/* You must not free palette here, because png_set_PLTE only makes a link to