PDA

View Full Version : About Palette files



Sam_Zen
03.11.2007, 08:39 AM
Of course the focus is on working in fullcolour mode, but there is enough material which is offered, or can be represented in a lower resolution.
The first lower step means 8 bits, so a maximum of 256 different colours.
Each colour is represented by values of Red - Green - Blue, each value with a range of 0-255.
Such a palette can be easily saved as a simple ascii file with on each line the three RGB values.

0 0 0
24 0 8
56 16 24
64 16 24
80 24 32
etc.

IrfanView does this too, when 'exporting a palette'. It writes a *.PAL file.
This means, that it's possible to build a library of palettes.
One could open pic1 and import the .pal-file of pic2.
So the palette can be a tool of modulation of the picture, like the Swap Colors option.
Not by controlling some sliders, but as a switch.

A first, random, collection of 122 palettes can be found here (http://www.xs4all.nl/~samzen/download/iview/pals/pals0.7z)

IrfanView is following the PSP format when writing a .PAL file, which means an extra header on top
of the list of values:

JASC-PAL
0100
256

Other applications like fractal generators do save such a palette value list as well, often as a .MAP extension.
But without this extra header. I've made a MAP2PAL (http://www.xs4all.nl/~samzen/download/iview/pals/map2pal.7z) batch converter.

Some more sets : Pals 1 (http://www.xs4all.nl/~samzen/download/iview/pals/pals1.7z) and Pals 2 (http://www.xs4all.nl/~samzen/download/iview/pals/pals2.7z)

For the survey, make the IV subdirectory 'palettes' to extract the pal-sets to.

Sam_Zen
04.11.2007, 07:23 AM
Save this bitmap, and it will directly show the new loaded palette in its right order.


http://www.xs4all.nl/~samzen/download/iview/pals/pgrid_g.gif

To avoid possible modifications or resizing during the save process, the ZIP can be found here (http://www.xs4all.nl/~samzen/download/iview/pals/pgrid_g.7z).

Laurent
11.11.2007, 11:25 PM
Hi Sam_Zen,

I did it and loaded chroma.pal (Image / Palette / Import). Here is the result. Is it what I should get?

Laurent

Sam_Zen
12.11.2007, 12:53 AM
Certainly not. It should have been this :


http://www.xs4all.nl/~samzen/download/iview/pals/chroma.gif

Thanks for reminding me that there indeed should be an example, to check if the system works correctly.

About your attachment, I wondered how your browser-saving was done. Are you sure you saved the file still as a 8 BPP GIF?
If somewhere inbetween the file has become 24 BPP again, it will not work. Which is the case when using JPG in the process.
'Save as PNG' is possible, because it keeps the 8BPP status.
I checked, and "chroma.jpg" doesn't contain equally colored blocks anymore.
See the result if you import the same chroma.pal file once again, or use a color-dropper in a block..

As a matter of fact (I just tested this) now both GIF files can be used for the same purpose.
If "gray.pal" is imported in "chroma.gif", it should look like "palgrid_g8.gif" again.
And so, if a 3rd palette is imported in both GIFs, the result should be the same.

Edit: Now I noticed that your example has a size of 280x280. Resizing the original 320x320 makes it useless too.

Laurent
12.11.2007, 08:34 PM
Hi Sam_Zen,

Thanks a lot for your reply. The example you posted is what I get now with the Gimp. But not with IrfanView. Maybe there is something wrong in what I did:
- save your greyscale GIF image (from Mozilla/SeaMonkey 1.1.6)
- open it with IV
- Image / Palette / Import palette...
- load chroma.pal

Then the gif is displayed in IV exactly like the picture I posted. Colors are always strange, whatever the palette I load. For example, with earth.pal, there is no noticeable change (remains in the grays). With green.pal I get a range of... reds!

When I just load palgrid_g8.gif IV says 320 x 320, 8 BPP and Image / Palette / Display displays a 256 grays palette, like the image.

So I wonder what's going wrong. Maybe it's in the original GIF I use. Can you check it?

Laurent

Sam_Zen
13.11.2007, 01:47 AM
Again, the attachment provided here, is of no use for a test, because it is a JPG of 280x280, not the GIF anymore.
Maybe it has something to do with the attachment script of the forum.

So I did your recipe too (Firefox) but all went well.
To exclude any 'save as' modifications as possible cause, I made a zip-file to download "chroma.gif" here (http://www.xs4all.nl/~samzen/download/iview/pals/chroma.7z).

The first one happened to be greyscale, but you'll see that chroma.gif should show a new imported palette as well.
It's just about 256 colors, and no greyscale conversion should be in this process, it isn't relevant here.
Greyscale is just a quick way to get the exceptional situation, that every pixel has equal values for RGB.


.. save your greyscale GIF image (from Mozilla/SeaMonkey 1.1.6)
.. When I just load palgrid_g8.gif
This is not clear to me. Are these two different ways to download the gif file?

Sam_Zen
13.11.2007, 02:29 AM
~ Save the basic GIF, open with IV, and export the palette file as basic.pal
import another pal file
whatever the outcome, import then basic.pal again. It should look like the basic GIF.

~ It could look exactly the same, but technically as data maybe it's not.
Data comparison is needed here. The first lines (after the header) of the .pal file used for "palgrid_g8" are :

0 0 0
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
6 6 6
7 7 7
8 8 8
9 9 9
10 10 10
11 11 11

The first lines (after the header) of the .pal file used for "chroma" are :

48 48 48 'chromatic' color map
56 48 56 by Todd Hedenstrom
64 48 64
72 48 72
80 48 80
88 48 88
96 48 96
104 48 104
112 48 112
120 48 120

Sam_Zen
14.11.2007, 03:55 AM
The PNG format seems to function as well with the examples, so I will use that for further pictures.
Due to copyright complications I prefer to use the PNG format above the GIF one, if possible.
The zip-file now contains the PNG version too.

As seen with the chroma pal file, the original map files sometimes have extra comment text added.
I didn't experience any trouble with it while reading the pal-file, but to avoid any risk I moved
the textpart to an additional .txt-file if necessary.
So to implement those changes one should re-download "pals0.zip" and "pals1.zip".

The ultimate test came from a .pal file with all values the same (252), resulting into this one color PNG file :


http://www.xs4all.nl/~samzen/download/iview/pals/mono.png

If then an imported palette looks correct with different blocks and all, the viewer functions alright.

EDIT: I noticed the option in Misc3 : Miscellaneous/Import palette: use nearest color.
This should be disabled for correct funtioning.

Sam_Zen
09.12.2007, 06:23 AM
An example with color cycling of palettes can be found here (http://www.samshuijzen.nl/sam/toon02/1_newt3z.html)

Sam_Zen
10.12.2007, 02:28 AM
I found a page with : The Browser-Safe Web Palette by Lynda Weinman
http://www.lynda.com/hex.asp

Some aspects come in focus :
The actual palette has a limit of 216. The other 40 are free, to serve differences between PC and MAC.

And there are 2 different kinds : Based on Hue and based on Value. The two PAL-files derived from the examples :
http://www.xs4all.nl/~samzen/download/iview/pals/webhue.pal
http://www.xs4all.nl/~samzen/download/iview/pals/webval.pal

In the same article other file formats for palettes appear to be there, seeing the CLUTS, whatever that may be.
The zip contains data for several apps, Freehand, Painter, Photoshop, PhotoPaint, PaintShop Pro, and Windows.
They all appear to have their own format(s) for describing a palette.
SIT - BCF - ACO - CPL - CLUT
Or no extension (Painter) with another header :
ROWS 1
COLS 16
WIDTH 32
HEIGHT 32
TEXTHEIGHT 0
SPACING 1
R: 255, G:255, B:255
R: 255, G:255, B:204
etc
Only PSP looks familiar for IV :
http://www.xs4all.nl/~samzen/download/iview/pals/browser.pal

Sam_Zen
10.12.2007, 03:11 AM
This is a special category, because in these files all three RGB-values are the same.
Of course very relevant if one is dealing with a B/W photograph.

But there are complications in the process.
Starting from a 24 BPP image one can travel several roads to make it greyscale.
1~ Choose direct 'Image/Convert to Greyscale'
2~ Choose 'Decrease color depth' to 256 colors, with 'make grayscale image' enabled.
3~ Choose 'Decrease color depth' to 256 colors, save, and then do 'Image/Convert to Greyscale'.
4~ Import a greyscale palette directly into a 24 BPP image to make it 8 BPP.

Saving each palette file of the result will probably be different.
An example about 'odd' behaviour in this :
I do a 'Image/Convert to Greyscale' and then save the PAL file, it appears to be the standard 0-255 value file.
With the proper representation in greyscale tints.
If I directly import that same PAL file in the original 24 BPP file, it shows a different result (nr3):

http://www.xs4all.nl/~samzen/download/iview/pals/anim_do.jpg
Several elements in these processes can play a role in this. I checked this apart from optional dithering.

Sam_Zen
10.12.2007, 03:47 AM
Since a file with a straight, lineair increase of the values 0.0.0 to 255.255.255, it could have another curve along the way,
I've tried to make some palfiles where the gamma-values are pepped up or turned down in the default picture setting.
But the pal file stays based on the same lineair increase unfortunately, if saved.
This is a pity. It would be quite convenient to be able to load variations of the lineair original, to emphasise gamma, brightness, etc., caught in some formula.

Sam_Zen
09.01.2008, 05:34 AM
I've found an opensource app called Color Select (http://www.xs4all.nl/~samzen/download/colsel3.7z). By Josiah Reynolds.
It's meant to be a color picker, but it's more than that.
First, it has very detailed information about the color in all kinds of codes.


http://www.xs4all.nl/~samzen/download/iview/pals/colsel.png

Second, it has a tool for opening, editing and saving a palette.
Due to the dialogs I noticed different kinds of palette formats :
*.PAL PSP type - *.PAL M$ type - *.ACT Photoshop type. Read and write, so the tool is a converter too.
It also has four default system palettes on board as a preset :
MacIntosh
Web 125 for Unix
Web 216
Windows system
So I retrieved these 4 files and packed them into Pals 3 (http://www.xs4all.nl/~samzen/download/iview/pals/pals3.7z)

Laurent
05.02.2008, 04:56 PM
Hi Sam Zen,

I tried again to work with your palettes and it didn't work, until I discovered an option in Options | Properties/Settings | Misc. 3 -> "Import palette: use nearest color". Since I unchecked that box, everything is working file. I don't know what this option is.

Laurent

Sam_Zen
06.02.2008, 01:38 AM
Nice. A valid warning in this topic.
I unchecked that box as well, because I didn't trust it. I wanted a straight, exact import of the palette.
And I wondered too : "nearest color" to what ?

Laurent
06.02.2008, 09:34 AM
Hi Sam Zen,

Another similar program is La boîte à Couleurs (http://pourpre.com/colorbox/index.php). Interesting for the name of the colors (in french). A page in english exists, but I don't know if the program is translated too.

Laurent

Sam_Zen
07.02.2008, 12:54 AM
Nice ColorBox. It runs in English too.

Sam_Zen
07.03.2008, 02:16 AM
While checking the fractal generator ManpWin (http://www.deleeuw.com.au/) by Paul de Leeuw,
I noticed that it uses the .MAP format for palette files, but also a new one, the 'True Color Map'.
It has the extension .COL, and contains an ascii-file with six decimal values. Wondering what these represent.

luciansabo
08.05.2008, 03:30 PM
Note that for grayscale conversion RGB values are not simply converted to shades of gray, but each color component is multiplied with a factor. This is based on human eye perception and gives better results.
There is a difference in quality between assigning a 256 grayshade pallete and properly converting to grayscale using these factors.

Sam_Zen
09.05.2008, 02:18 AM
You're absolutely right. there is a mathematical difference.
Nevertheless, the main issue here is just assigning some palette, not improving the quality as such.

bohdan
25.05.2008, 05:25 PM
I need help, I can't seem to use my palette in Microsoft GIF Animator! Could someone give me some help?

JASC-PAL
0100
256
0 200 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
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0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0

I'm going for monochrome. Someone tell me what I'm doing wrong!

Laurent
25.05.2008, 05:40 PM
Hi bohdan,

Your palette contains 257 values. Besides that, all values correspond to black, except the first one. I tried to use it with an image and, indeed, almost every pixels are black, except some that are green.
Can you describe more precisely what you expect?
What help about IrfanView do you need?

Laurent

bohdan
25.05.2008, 05:58 PM
Hi bohdan,

Your palette contains 257 values. Besides that, all values correspond to black, except the first one. I tried to use it with an image and, indeed, almost every pixels are black, except some that are green.
Can you describe more precisely what you expect?
What help about IrfanView do you need?

Laurent
So I would need to remove a value and swap green with black?

I am using Microsoft GIF animator. However, this was the only relevant result on google.

Laurent
25.05.2008, 06:18 PM
So I would need to remove a value and swap green with black?
I would remove a line of zeroes.


I am using Microsoft GIF animator. However, this was the only relevant result on google.
Search better: with ["Microsoft GIF animator" palette] Google gave 1910 results. Or search on Microsoft website. I know nothing of Microsoft GIF animator. We support only IrfanView. Thanks for your comprehension.

Laurent

bohdan
25.05.2008, 06:34 PM
Well I found nothing relevant. Oh well, one of my friends can help I guess.

Laurent
18.08.2008, 12:04 PM
Hi Sam,

Here are visualizations of your palettes (I downloaded the files some time ago: November 2007). Nice patchworks :)
The palette pals1\green.pal is puzzling me. And pals1\hq_32.pal has four browns among the blues.

Laurent

Sam_Zen
19.08.2008, 12:59 AM
I have to admit that I didn't check every single pal in those packages. green.pal is puzzling indeed. It should be red.pal, or re-coloured.
And those four browns are not supposed to be there. Thanks. I will correct both files.
Nice visualizations by the way.

Birkinstein
17.09.2009, 04:21 PM
Hello,

I've tried importing palettes and I get the same problem as reported by Laurent early in this thread. That problem seemed to be solved by setting the option in what used to be: Options | Properties/Settings | Misc. 3 -> "Import palette: use nearest color".

But in v4.25 the options menu is much simpler, and I can't find it. Does anyone know how to solve this?

Bhikkhu Pesala
17.09.2009, 04:56 PM
Its in the Editing section of Browsing/Editing

Birkinstein
18.09.2009, 10:55 AM
Thanks very much - I couldn't find it! Working OK now.

MaxBeta
22.04.2011, 12:43 AM
Hello, I've been using Infranview for some time and love it!

I want to know is there's a way to have the program batch import a palette file to many .pcx images (more than 100)

Thanks in advance.

MaxBeta
26.04.2011, 01:30 PM
Nevermind, I found this after searching some elsewhere in the forums;

i_view32.exe C:\mypics\*.png /import_pal=C:\1.pal /convert=C:\temp\*.png

i_view32.exe /filelist=C:\mypics.txt /import_pal=C:\1.pal /convert=D:\temp\*.png

Mij
26.04.2011, 04:20 PM
Well, I hope it works for you. I did not reply because I have not used a .pcx file for many years and could not remember whether the palette they used was compatible with Irfanview. Let us know how you get on.