I need a 256 pixels color palette because FFmpeg gives me this error:
Palette input must contain exactly 256 pixels.
I use ImageMagick on Mac OS to create a GIF palette from an image that contains a few shades of grey so I don't need that large color palette. The way Palettegen
generates palette is it takes a number of max colors, for example, max_colors=8
and fills the rest 248 pixels with black. I want to do the same with convert
.
Is there a way to specify max colors number in ImageMagick convert and fill rest of the 256 color palette with black?
You can do that rather easily in ImageMagick (for 8 grays) by creating a 256x1 black image and compositing your 8 gray shades from your image onto it at the beginning.
convert \( -size 256x1 xc:black \) \( image -colorspace gray -dither none -colors 8 -unique-colors \) -compose over -composite colormap.gif