1. palette remap

Guys,

I have a bitmap (a photo) that uses almost all 256 available colors. I
want to use 64 colors for something else. How do I remap existing 256
colors into just 192 with a minimal distortion? I would prefer
Euphoric solution to expensive commercial packages. Anybody with a
ready-made function? Pete, Colin? Thanks jiri.

new topic     » topic index » view message » categorize

2. Re: palette remap

--part0_920352099_boundary
Content-ID: <0_920352099 at inet_out.mail.aol.com.1>
Content-type: text/plain; charset=US-ASCII

Here's a utility I nabbed off of X2FTP long ago. It comes with full C++ source
even. Hope it's of use to you. :)

- aen

--part0_920352099_boundary
Content-ID: <0_920352099 at inet_out.mail.aol.com.2>
Content-type: application/zip;
        name="PALRED.ZIP"

new topic     » goto parent     » topic index » view message » categorize

3. Re: palette remap

>I have a bitmap (a photo) that uses almost all 256 available colors. I
>want to use 64 colors for something else. How do I remap existing 256
>colors into just 192 with a minimal distortion? I would prefer
>Euphoric solution to expensive commercial packages. Anybody with a
>ready-made function? Pete, Colin? Thanks jiri.

You can steal 'Neal' matching function, jiri.
Its in there somewhere. It just matches the colors of a bitmap to the best match
with the current palette, without altering that
palette.
But you will problely be able to use it in that way. Also Lucius Hilley ones
made a library with all kinds of palette routines,
it should be somewhere on the archives.

And you could off course just go 'true color'

Ralf

new topic     » goto parent     » topic index » view message » categorize

4. Re: palette remap

you can use paint shop pro. it allows you to reduce the color
depth to X colors and that'll save space for the 64 colors you need.
i don't know about the newest version of psp, but version 3.x can do it.

new topic     » goto parent     » topic index » view message » categorize

5. Re: palette remap

Message text written by Jiri
>I have a bitmap (a photo) that uses almost all 256 available colors. I
want to use 64 colors for something else. How do I remap existing 256
colors into just 192 with a minimal distortion? I would prefer
Euphoric solution to expensive commercial packages. Anybody with a
ready-made function? Pete, Colin? Thanks jiri.
<
Good morning.  In my recent palette utilities package there is a routine
called systemize_image().  You can apply your 64 color palete to the imag=
e
as a system palette.  Your system palette will occupy the first 64 colors=

of the new palette.  This routine has the advantage that it will try to u=
se
the new system colors in the image as well as the remaining 192 colors,
thus minimising color distortion.  You can further reduce distortion by
next dithering the old image/old palette to the new systemized palette.

Colin

new topic     » goto parent     » topic index » view message » categorize

6. Re: palette remap

Thanks, guys. Massive! (Obnoxious exclamation one of my sons loves to
irritate me with...)


Aen wrote:


>Here's a utility I nabbed off of X2FTP long ago. It comes with full C++
source
>even. Hope it's of use to you. :)


Intriguing piece of software. And very clever, judging from the supplied
examples. But it does not quite suit me, it seems to require full screen
image (320x200x256 pcx). I might finish translating it into Euphoria...


Ralf wrote:

>You can steal 'Neal' matching function, jiri.

It's Neil, Ralf. For a guy who is very particular about spelling of his own
name you are pretty cavalier when dealing with anybody else's names...blink
Seriously, I had a quick look through many of Pete's files, but I could not
find just the right thing. Thanks, Ralf.


Lucius wrote:

>These are some routines that I wrote.  Maybe they will help.
>In the mean time I will be working on a palette resizing routine.

Well, they don't. But keep working on that palette resizing routine. That's
what I really need. Btw, do you want to take the translation job I mentioned
above off my hands? You could do much worse than that. Thanks anyway.


Mark wrote:

>you can use paint shop pro.

That's what I tried. But my trial copy expired many moons ago. Another of my
sons has a legal copy of the latest (bloated) PSP, but he would not share it
with me, because HE paid for it (my wife keeps telling me *I am* responsible
for their upbringing!). -Thanks, Mark, I am just downloading another trial
copy, all 5 or 6 Mbytes of it...  jiri

new topic     » goto parent     » topic index » view message » categorize

7. Re: palette remap

Colin Taylor wrote:

>Good morning.  In my recent palette utilities package there is a routine
>called systemize_image().  You can apply your 64 color palete to the image
>as a system palette.  Your system palette will occupy the first 64 colors
>of the new palette.  This routine has the advantage that it will try to use
>the new system colors in the image as well as the remaining 192 colors,
>thus minimising color distortion.  You can further reduce distortion by
>next dithering the old image/old palette to the new systemized palette.



Good morning, indeed. It's 3.30 am here in Kiwiland, and I have to go to
work in just a few hours...

Colin, I had a good look at your pal_util.e and somehow still managed to
miss the routine. It will probably do what I want, but I am not quite sure
about the meaning of the 'exact' flag. (Most likely it will have to be set
to zero, because the first 64 colors will be continually changing?) Thanks
jiri

new topic     » goto parent     » topic index » view message » categorize

8. Re: palette remap

Message text written by Jiri
>I am not quite sure about the meaning of the 'exact' flag.<

In the systemize_image() routine the 'exact' flag works like this:
    exact=3D0 - the image palette is re-arranged so that you have somethi=
ng
resembling the system palette at the beginning (meaning that the image wi=
ll
have *no* color distortion but the system palette may have color
distortion)
    exact=3D1 - the exact system palette is preserved (possibly causing s=
ome
color distortion in the image)

You should do the following:

<code>
new_image =3D systemize_image(sys_palette, old_image, 1)
new_image =3D dither_image(new_image[1], old_image)
</code>

However...  if you will be changing the system colors this won't work for=

you.  Let me give it some more thought.

Colin Taylor

new topic     » goto parent     » topic index » view message » categorize

9. Re: palette remap

Thank you Ralf,  I believe it is labeled Hilley's Utilities at the Archives.

On Tue, 2 Mar 1999 08:29:51 +0100, Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL>
wrote:

>>I have a bitmap (a photo) that uses almost all 256 available colors. I
>>want to use 64 colors for something else. How do I remap existing 256
>>colors into just 192 with a minimal distortion? I would prefer
>>Euphoric solution to expensive commercial packages. Anybody with a
>>ready-made function? Pete, Colin? Thanks jiri.
>
>You can steal 'Neal' matching function, jiri.
>Its in there somewhere. It just matches the colors of a bitmap to the best
match with the current palette, without altering that
>palette.
>But you will problely be able to use it in that way. Also Lucius Hilley
ones made a library with all kinds of palette routines,
>it should be somewhere on the archives.
>
>And you could off course just go 'true color'
>
>Ralf

new topic     » goto parent     » topic index » view message » categorize

10. Re: palette remap

> >You can steal 'Neal' matching function, jiri.
>
> It's Neil, Ralf. For a guy who is very particular about spelling of his
> own name you are pretty cavalier when dealing with anybody else's
> names...blink

Neil is just the code name.. it doesn't really matter.  People can spell
it however they want.. (and they do!  Niel,Neal)

> Seriously, I had a quick look through many of Pete's files, but I could
> not find just the right thing. Thanks, Ralf.

Yeah, well Neil wasn't written with palette reduction specifically in
mind.. but I did manage to cobble together a program that does the trick.
It also forced me to write the save_bitmap8 routine for 256-color images.

While you're there, warp your mind with a wormhole tunnel effect:

Later,
 _______  ______  _______  ______
[    _  \[    _ ][ _   _ ][    _ ]
[/| [_] |[/| [_\][/ | | \][/| [_\]
  |  ___/  |  _]    | |     |  _]
[\| [/]  [\| [_/] [\| |/] [\| [_/]
[_____]  [______] [_____] [______]
xseal at harborside.com  ICQ:13466657
http://www.harborside.com/home/x/xseal/euphoria/

new topic     » goto parent     » topic index » view message » categorize

11. Re: palette remap

To Aen Aen:

A 233K attachment is excessive for this list.
While a few people may have been happy to receive it,
a couple of hundred others were probably very annoyed at
the extra time (and money) they were forced to spend
downloading it.

It would have been better to send it privately, post
a link to it, or simply describe where to find it on
the Internet.

Regards,
     Rob Craig
     Rapid Deployment Software
     http://members.aol.com/FilesEu/

new topic     » goto parent     » topic index » view message » categorize

12. Re: palette remap

>Neil is just the code name.. it doesn't really matter.  People can spell
>it however they want.. (and they do!  Niel,Neal)

Magnanimous gesture!

>Yeah, well Neil wasn't written with palette reduction specifically in
>mind.. but I did manage to cobble together a program that does the trick.
>It also forced me to write the save_bitmap8 routine for 256-color images.


Thanks, Pete. I have not been able to test it yet, because none of the NT
machines at work can handle Neil, but just looking at it I am pretty sure it
will work. jiri

new topic     » goto parent     » topic index » view message » categorize

13. Re: palette remap

>Yeah, well Neil wasn't written with palette reduction specifically in
>mind.. but I did manage to cobble together a program that does the trick.
>It also forced me to write the save_bitmap8 routine for 256-color images.

Pete, I noticed you updated *Neil* (yes, spelled correctly) with font-routines,
and save-bitmap routines, however..
I noticed that the save_bitmap8 routine will not work with images containing
  #RRGGBB pixels, and that save_bitmap24 will not
work with imaging using palette indexes. Couldnt there at least be some
'generic' function that selected the best method for
saving ?

I was wondering as well, why wouldnt both routines be able to save images using
either heximal or indexed pixel format ?

And now we're on the topic, (and since you've written it anyway already) couldnt
your 'reduce-palette' be included in Neil as a
procedure to say 'Free' this many palette entries and in true color mode it is
simply 'does' nothing, something like
'free_palette (38)' .. frees 38 palette entries

>While you're there, warp your mind with a wormhole tunnel effect:

What have you been on ? No.. just joking. Very cool effect blink

Ralf

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu