How to obtain the right 256 color pallette for the blend of two colors...?

S

SammyBar

Hi all,

I have the following problem: I need to generate dynamically an image with
IndexColorModel (256 color PNG) of a text over a solid color. The parameters
are color foreground for the text and background. The problem is how to
select the most appropriate 256 color pallette for the text to look best. I
mean the text should be antialiased and any other hint applied. For example,
If I pick black on yellow image I think it should have all the tones of
black and yellow. Any red color will be useless and it will be lost space on
the reduced 256 color pallette. But in this example the red could be a good
choice for the transparent color...
How to solve this problem?
I guess I need some background on colors (theory of colors?) Any hint is
welcomed.
Thanks in advance
Sammy
 
O

Oliver Wong

SammyBar said:
Hi all,

I have the following problem: I need to generate dynamically an image
with IndexColorModel (256 color PNG) of a text over a solid color. The
parameters are color foreground for the text and background. The problem
is how to select the most appropriate 256 color pallette for the text to
look best. I mean the text should be antialiased and any other hint
applied. For example, If I pick black on yellow image I think it should
have all the tones of black and yellow. Any red color will be useless and
it will be lost space on the reduced 256 color pallette. But in this
example the red could be a good choice for the transparent color...
How to solve this problem?
I guess I need some background on colors (theory of colors?) Any hint is
welcomed.

256 colour PNGs only support single bit transparency (as opposed to
alpha transparancy). If you need a transparent colour, then assign any
arbitrary colour to the transparent one (e.g. colour 0 in the palette
index), and then you have the exact same problem as before, except you need
to assign 255 colours, instead of 256.

If it's a single colour text on a single colour background (e.g. black
on yellow), then simply assign the 255 colours to be a steady gradient from
black to yellow.

- Oliver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top