Post Reply 

How to set the palette on a png and can I easily load a list of integers as a palette

Mar 8, 2012, 05:48
Post: #1
How to set the palette on a png and can I easily load a list of integers as a palette
Hey, I've only ever used gimp sparingly and for simple stuff. I now need to set the palette of a 8-bit png to a specified palette, but I can't find any in gimp or online about how to load a palette. I need the palette to contain colors that may not be in the image if thats possible as these images are sprites of under 40 colors, but I need a full 256 color palette. Also is there any simple way to convert a string of numbers into a gimp palette? If not Ill probably just look at how they are saved and just write a simple script, but I thought i would ask.
Thanks for any help
Find all posts by this user
Quote this message in a reply
Mar 8, 2012, 07:38 (This post was last modified: Mar 8, 2012 09:14 by ofnuts.)
Post: #2
RE: How to set the palette on a png and can I easily load a list of integers as a palette
Gimp has the concept of palettes, which are predefined sets of colors that you can use to set you brush color to, and of color maps, which are used for color-indexed files (GIF and some forms of PNG). I'm not saying this to be pedantic, but to spare you searching things in the wrong dialogs as I did Smile

You can create/edit palettes using the palette editor: "Windows/Dockable dialogs/Palettes" to get the palettes list, then click on the New/Edit icons at the bottom. but given the format of palette files they should be easy enough to create outside of Gimp:
Code:
GIMP Palette
Name: Basic
Columns: 1
#
  0   0   0    Untitled
255 255 255    Untitled
255   0   0    Untitled
255 255   0    Untitled
  0 255   0    Untitled
  0 255 255    Untitled
  0   0 255    Untitled
255   0 255    Untitled
64  64  64    Untitled
128 128 128    Untitled
191 191 191    Untitled
(note: there is a tab character before the title name). Palettes are stored in the "palettes" subdirectory of your Gimp profile.

You can edit the color map of an indexed image using the color map editor: "Windows/Dockable dialogs/Color map".

When you color-index an image ("Image/Mode/Indexed"), instead of letting Gimp figure out the best set of colors for the color map, you can provide a palette to pick the colors from. This is the "bridge" between palettes and color maps.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Mar 8, 2012, 16:36
Post: #3
RE: How to set the palette on a png and can I easily load a list of integers as a palette
Hey thanks for the help. Everything you said was right (except I don't think the tab before the title name is neccessary, but that is trivial). However it turns out I need to change the indexed palette (color map) to match the palette. I now have the palette I need and can choose it when I color index an image, but the colormap still only contains the colors used in the image while I need it to equal the entire palette. Thanks for the help
Find all posts by this user
Quote this message in a reply
Mar 8, 2012, 16:48
Post: #4
RE: How to set the palette on a png and can I easily load a list of integers as a palette
Ok a little more searching and I found I just need color>set color map, which now does the job of setting the full colormap, but it looks like it converts the colors I have now into the first set of colors in the palette, which is just grayscale. The colors in the image are indeed all in the color, because before I set the colormap to equal the palette, I set the palette when I color indexed the image. Maybe I just don't have a good enough understanding of how color indexing works, but is there any way to set the colormap while keeping the colors I have now (which are still in the colormap). Thanks again if you can help
Find all posts by this user
Quote this message in a reply
Mar 8, 2012, 17:08
Post: #5
RE: How to set the palette on a png and can I easily load a list of integers as a palette
Ok, so there is a checkbox for remove unused colors when I index the image. I think its fair to say I am an idiot and you can ignore my questions.
Find all posts by this user
Quote this message in a reply
Mar 8, 2012, 17:11
Post: #6
RE: How to set the palette on a png and can I easily load a list of integers as a palette
(Mar 8, 2012 16:36)Shatners Wrote:  I now have the palette I need and can choose it when I color index an image, but the colormap still only contains the colors used in the image while I need it to equal the entire palette. Thanks for the help
I explicitly tested this before answering and I found that Gimp would keep the complete palette as a color map, unless I check the "Remove unused colors from colormap" box (just under the custom palette choice)

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
Question Indexed palette of exact colors? chupo_cro 3 224 Sep 8, 2014 11:08
Last Post: chupo_cro
  How to set gradually changing opacity of a layer? adamail 2 277 Sep 4, 2014 07:30
Last Post: adamail
  Editing an Un-editable png with GIMP jasonmzs 1 285 Jun 16, 2014 09:09
Last Post: ofnuts
  Set Multiple actions to mouse wheel uzarnom 4 354 May 31, 2014 07:53
Last Post: iForStyle007
  .xcf to .png Unisus41 8 1,840 May 3, 2014 16:22
Last Post: cki

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS