Start a new topic

swapping color palettes

Original Post by: perezucf Thu Nov 21 19:12:29 2013


I am trying to switch color palettes while trying to maintain the colors as close as possible but I am having some trouble. My approach was to save a mapping of the original indexes to rgb values and then after loading in the new color palette use that mapping to figure out what the new index values should be using the rgb values I previously stored.


My problem is that after I load the new color palette all my original indexes change. Can anyone explain what is going on? I figured that the indexes would be unchanged.


Original Post by: SteveThompson Mon Nov 25 16:53:41 2013


For some reason that did not work for me. The import of the new palette did not match any of the colors and wasn’t even close for most of them.

Hmmm... this should not be the case. Is there any way you can post the files here on the forum so we can have a look? If you could zip up the palette file and the original db and attach here, we'd really appreciate your help.

Original Post by: perezucf Mon Nov 25 14:55:20 2013


For some reason that did not work for me. The import of the new palette did not match any of the colors and wasn't even close for most of them. What is weird is that once I stored the colors and manually made the calls to mgRGB2Index it returned the appropriate index in the new palette.

Original Post by: SteveThompson Fri Nov 22 22:59:40 2013


My problem is that after I load the new color palette all my original indexes change. Can anyone explain what is going on? I figured that the indexes would be unchanged.

When you load a new color palette into a db, the API tries to keep the colors (rgbs, not the indices) of your geometry the same. So if the colors in the new palette are different than those in the original palette, you would expect the indices on the geometry to change (to the indices in the new palette that best match the colors in the original palette).


You also say:

I am trying to switch color palettes while trying to maintain the colors as close as possible ...
Sounds like this is what you wanted all along. Perhaps you don't need to remap at all, just let the API do its thing.
Original Post by: perezucf Thu Nov 21 22:13:04 2013


Couldn't figure it out so I just ended up making a mapping between the node name and color and doing it that way instead.

Login to post a comment