java - Choosing 15 colors from a 159 color palette to recolor (quantize) an image -
my question is, best way use imagemagick (or java library) recolor image using 15 colors chosen 159 color static palette. use 15 colors create 15_color_palette.png , use remap function of imagemagick convert recolor image.
convert input.png +dither -remap 15_color_palette.png output.png
i've tried couple of different methods, neither of them work enough (at least think better -- guess it's possible there no better method).
example 1:
convert input.png +dither -colors 15 work/15_color.png convert work/15_color.png -unique-colors work/15_color_palette.png convert work/15_color_palette.png -remap work/palette.png work/15_color_palette_converted.png convert input.png +dither -remap work/15_color_palette_converted.png work/final.png
(this 1 chooses 15 colors colors, remaps palette 15 colors 159 color palette palette , uses 15 colors recolor original image).
example 2:
convert +dither -remap work/palette.png work/remap.png #use java count top 15 colors used remap, recolor original using 15 colors convert +dither -remap work/temp_palette.png work/final.png
Comments
Post a Comment