Skip to content

Commit

Permalink
set max colormap size for remap
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Aug 25, 2024
1 parent 4b6bc43 commit b7dde52
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions magick/quantize.c
Original file line number Diff line number Diff line change
Expand Up @@ -3127,8 +3127,7 @@ MagickExport MagickBooleanType RemapImage(const QuantizeInfo *quantize_info,
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(remap_image != (Image *) NULL);
assert(remap_image->signature == MagickCoreSignature);
cube_info=GetQCubeInfo(quantize_info,MaxTreeDepth,
quantize_info->number_colors);
cube_info=GetQCubeInfo(quantize_info,MaxTreeDepth,MaxColormapSize);
if (cube_info == (QCubeInfo *) NULL)
ThrowBinaryImageException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
Expand All @@ -3140,6 +3139,8 @@ MagickExport MagickBooleanType RemapImage(const QuantizeInfo *quantize_info,
Classify image colors from the reference image.
*/
cube_info->quantize_info->number_colors=cube_info->colors;
if (cube_info->colors > cube_info->maximum_colors)
ReduceImageColors(image,cube_info);
status=AssignImageColors(image,cube_info);
}
DestroyQCubeInfo(cube_info);
Expand Down

0 comments on commit b7dde52

Please sign in to comment.