Announcement

Collapse
No announcement yet.

About Palette files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    About Palette files

    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

    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 batch converter.

    Some more sets : Pals 1 and Pals 2

    For the survey, make the IV subdirectory 'palettes' to extract the pal-sets to.
    Last edited by Sam_Zen; 18.02.2008, 04:06 AM. Reason: other format
    0.6180339887
    Rest In Peace, Sam!

    #2
    Palette viewer

    Save this bitmap, and it will directly show the new loaded palette in its right order.


    To avoid possible modifications or resizing during the save process, the ZIP can be found here.
    Last edited by Sam_Zen; 18.02.2008, 04:07 AM. Reason: other format
    0.6180339887
    Rest In Peace, Sam!

    Comment


      #3
      Hi Sam_Zen,

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

      Laurent
      Attached Files
      Before you post ... fill in your OS and IV version in your profile.

      Comment


        #4
        Certainly not. It should have been this :


        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.
        Last edited by Sam_Zen; 12.11.2007, 04:29 AM.
        0.6180339887
        Rest In Peace, Sam!

        Comment


          #5
          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
          Attached Files
          Before you post ... fill in your OS and IV version in your profile.

          Comment


            #6
            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.

            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?
            Last edited by Sam_Zen; 18.02.2008, 04:09 AM. Reason: other format
            0.6180339887
            Rest In Peace, Sam!

            Comment


              #7
              Checking the system

              ~ 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
              0.6180339887
              Rest In Peace, Sam!

              Comment


                #8
                Upgrade

                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 :


                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.
                Last edited by Sam_Zen; 14.11.2007, 05:49 AM.
                0.6180339887
                Rest In Peace, Sam!

                Comment


                  #9
                  An example with color cycling of palettes can be found here
                  0.6180339887
                  Rest In Peace, Sam!

                  Comment


                    #10
                    web-save palettes

                    I found a page with : The Browser-Safe Web Palette by Lynda Weinman


                    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 :



                    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 :
                    0.6180339887
                    Rest In Peace, Sam!

                    Comment


                      #11
                      About greyscale palettes

                      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):
                      Several elements in these processes can play a role in this. I checked this apart from optional dithering.
                      Last edited by Sam_Zen; 02.01.2008, 07:02 AM.
                      0.6180339887
                      Rest In Peace, Sam!

                      Comment


                        #12
                        About greyscale palettes II

                        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.
                        0.6180339887
                        Rest In Peace, Sam!

                        Comment


                          #13
                          I've found an opensource app called Color Select. 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.


                          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
                          Last edited by Sam_Zen; 18.02.2008, 04:12 AM. Reason: other formats
                          0.6180339887
                          Rest In Peace, Sam!

                          Comment


                            #14
                            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
                            Before you post ... fill in your OS and IV version in your profile.

                            Comment


                              #15
                              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 ?
                              0.6180339887
                              Rest In Peace, Sam!

                              Comment

                              Working...
                              X