Results 1 to 3 of 3

Thread: Convert an image palette into a lookup table

  1. #1
    Professional Artist Naima's Avatar
    Join Date
    Mar 2010
    Location
    Italy
    Posts
    1,587

    Default Convert an image palette into a lookup table

    Does someone have any idea on how to convert an image color palette into an ordered lookup color table?

  2. #2
    Administrator waldronate's Avatar
    Join Date
    Mar 2007
    Location
    The High Desert
    Posts
    3,611

    Default

    I would think that it depends on the precise image format and what you want in your lookup table. Most image editing tools have an option to save a palette and load a new palette, but they have a tendency to want to convert palettes to preserve colors in the image (that is, they tend to convert to RGB from the original palette and then back to indexed color on the new palette).

    If you want to do something like convert an 8-bit PNG with arbitrary colors into an 8-bit PNG with grayscale colors that represent height, then you'd replace the PLTE chunk with a different one. For best results (and to avoid having to recode everything), you'd want to write the PLTE chunk to a file that's easy to edit (like text), edit the PLTE, then read the new one back from the file.

    https://onlinepngtools.com/change-png-color looks like it might allow interactive adjustments of an 8-bit PNG.

    If your image is something other than an 8-bit PNG, complexity will increase. I did a generalized "color to altitude" thing for Fractal Terrains some years back that will convert colors in an image to altitudes in its internal map, but (a) it's Fractal Terrains and (b) it doesn't do a particularly good job at color edges or dithering.

  3. #3
    Professional Artist Naima's Avatar
    Join Date
    Mar 2010
    Location
    Italy
    Posts
    1,587

    Default

    Quote Originally Posted by waldronate View Post
    I would think that it depends on the precise image format and what you want in your lookup table. Most image editing tools have an option to save a palette and load a new palette, but they have a tendency to want to convert palettes to preserve colors in the image (that is, they tend to convert to RGB from the original palette and then back to indexed color on the new palette).

    If you want to do something like convert an 8-bit PNG with arbitrary colors into an 8-bit PNG with grayscale colors that represent height, then you'd replace the PLTE chunk with a different one. For best results (and to avoid having to recode everything), you'd want to write the PLTE chunk to a file that's easy to edit (like text), edit the PLTE, then read the new one back from the file.

    https://onlinepngtools.com/change-png-color looks like it might allow interactive adjustments of an 8-bit PNG.

    If your image is something other than an 8-bit PNG, complexity will increase. I did a generalized "color to altitude" thing for Fractal Terrains some years back that will convert colors in an image to altitudes in its internal map, but (a) it's Fractal Terrains and (b) it doesn't do a particularly good job at color edges or dithering.
    Thankyou ! Basically I wanted to create a loookup table to load in Wilbur .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •