Class PaletteSerialization

  • All Implemented Interfaces:
    RGBIndex

    public class PaletteSerialization
    extends Object
    implements RGBIndex
    This class loads and saves palettes. Loading is done using the ImageLoader class - an image is loaded which is supposed to have no more than 256 pixels, the palette entries. When saving, the PNMCodec is used to store palettes as .ppm files.
    Since:
    0.5.0
    Author:
    Marco Schmidt
    • Constructor Detail

      • PaletteSerialization

        private PaletteSerialization()
    • Method Detail

      • convertImageToPalette

        public static Palette convertImageToPalette​(RGB24Image image)
        Create a palette from the pixels of the argument image.
      • convertPaletteToImage

        public static RGB24Image convertPaletteToImage​(Palette palette)
        Creates an RGB24Image from the palette entries, each entry becomes a pixel in an image of width 1 and height palette.getNumEntries().