# Topic awaiting preservation: calculating the average of two hex colors? (Page 1 of 1)

mas
Paranoid (IV) Inmate

From: the space between us
Insane since: Sep 2002

posted 10-12-2003 14:13

mhmm....anyone knows how to do this? i always did the PS layer hack, with setting the upper layer's visibility to 50% but i have heard that the result isn't correct if you do it this way....any advices?

InI

From: Somewhere over the rainbow
Insane since: Mar 2001

posted 10-12-2003 14:16

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

mas
Paranoid (IV) Inmate

From: the space between us
Insane since: Sep 2002

posted 10-12-2003 14:32

#^2*(2x+45,041^2xyß/15*87F= OMG! i was hoping that it would be easier though
thx InI, i will try to understand that

mas
Paranoid (IV) Inmate

From: the space between us
Insane since: Sep 2002

posted 10-12-2003 14:41

is there also a way to calculate this without getting back to decimals?

HZR
Bipolar (III) Inmate

From: Cold Sweden
Insane since: Jul 2002

posted 10-12-2003 15:06

You could use: http://www.meyerweb.com/eric/tools/color-blend/

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted 10-12-2003 15:16

mas: The PS layer hack works. At worst it can bring some rounding error, but who cares if your color are fooled of 256th of tint ?

If you don't want to use decimal or complex calculations, you can use a calculator supporting hexadecimal ( like Microssoft's one when set in 'scientific mode' in the 'Display' options ). The method consist in using 16:16 Fixed Point. It may sound complex but it's not. Take a real world example :

1. color 1 = CF93E5

color 2 = FF6E8C
2. now insert some 'void' between the shade ( to give enough bits for the Fixed Point )

color1fp = CF009300E5

color2fp = FF006E008C

colorSummedFp = 1CE01010171
4. Divide colorSummedFp by 2

colorDividedFp = colorSummedFp / 2 = E7008080B8
5. Finally remove the 'voids' ( the Fixed Point bits ) we've added in the step 2.

colorAverge = E780B8

And voilà. This very method should work even if you wish to average 65536 colors.
To double check, here comes the resulting colors obtained with the PS layer hack :
color1 + 50% of color2 = E780B8
color2 + 50% of color1 = E781B9 The difference is *hardly* visible.

[EDIT] The Color Blender @ meyerweb gives E781B9 [/EDIT]

Hope that didn't scared you

Mathieu "POÏ" HENRI

[This message has been edited by poi (edited 10-12-2003).]

mas
Paranoid (IV) Inmate

From: the space between us
Insane since: Sep 2002

posted 10-12-2003 15:18

oh and thx for the link, HZR

[This message has been edited by mas (edited 10-12-2003).]

InI

From: Somewhere over the rainbow
Insane since: Mar 2001

posted 10-12-2003 15:19

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted 10-12-2003 15:24

InI: Just done it

:FAQ: How do you calculate the average of two (or more) colours?

___________________
Emps

The Emperor dot org

Nimraw
Paranoid (IV) Inmate

From: Styx
Insane since: Sep 2000

posted 10-12-2003 17:28

I might be stupid, but can't you do this using the windows calculator?

Switch mode to scientific, choose Hex and then just calculate away?

Xel
Bipolar (III) Inmate

From: Trumansburg, NY, USA
Insane since: Nov 2002

posted 10-12-2003 17:43

I wouldn't know ^^^
But I do know that my TI-89 does it. And binary too.
And I was working on a program to convert dec/bin/hex to octal

-Xel

InI

From: Somewhere over the rainbow
Insane since: Mar 2001

posted 10-12-2003 17:51

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted 10-12-2003 18:00

Nimraw: That's not stupid, and that's one of the reasons why I said:

quote:
...you can use a calculator supporting hexadecimal ( like Microssoft's one when set in 'scientific mode' in the 'Display' options )...

Mathieu "POÏ" HENRI

Nimraw
Paranoid (IV) Inmate

From: Styx
Insane since: Sep 2000

posted 10-12-2003 18:05

doh!