Skip to content

Commit

Permalink
No longer change image_colors and stop using image->colors to resolve…
Browse files Browse the repository at this point in the history
… the issue reported in #7298.
  • Loading branch information
dlemstra committed May 9, 2024
1 parent f95e6e4 commit d0c0939
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions coders/png.c
Original file line number Diff line number Diff line change
Expand Up @@ -9346,7 +9346,6 @@ static MagickBooleanType WriteOnePNGImage(MngWriteInfo *mng_info,

quantum_info = (QuantumInfo *) NULL;
number_colors=0;
image_colors=(int) image->colors;
image_matte=image->alpha_trait !=
UndefinedPixelTrait ? MagickTrue : MagickFalse;

Expand All @@ -9358,7 +9357,7 @@ static MagickBooleanType WriteOnePNGImage(MngWriteInfo *mng_info,
mng_info->is_palette=MagickFalse;

if (((mng_info->colortype == 4) || (mng_info->write_png8 != MagickFalse)) &&
((image->colors == 0) || (image->colormap == NULL)))
((image_colors == 0) || (image->colormap == NULL)))
{
image_info=DestroyImageInfo(image_info);
image=DestroyImage(image);
Expand Down Expand Up @@ -9807,7 +9806,7 @@ static MagickBooleanType WriteOnePNGImage(MngWriteInfo *mng_info,
size_t one = 1;
ping_bit_depth=1;

if (image->colors == 0)
if (image_colors == 0)
{
/* DO SOMETHING */
png_error(ping,"image has 0 colors");
Expand Down

0 comments on commit d0c0939

Please sign in to comment.