CONTENTS

Home
Updates
Software
Electronics
Android / iOS
Videos
Music
Resume
Contact



HTTPS VERSION


YUV <--> RGB Javascript Converter

Introduction

I wrote this as a tool for help with programming some Atari 2600 stuff I was working on. Since the Atari basically has 16 set colors and each color has a 3 bit attribute to change the brightness of the color, I needed a way to visualize the colors and create the different shades. The most accurate way to create shades of colors seems to be to use the YUV color space since the UV portion would define the color and the Y portion would describe how bright it is. So basically what I plan to do is mix the colors using the RGB part of the Javascript until I get a color I like, and then plug the YUV values into the Television.java class. At that point I'll write code that converts these YUV colors to RGB 8 times while lowering the Y value each time. Thus, I should have some pretty accurate representations of what the Atari does.

The code here uses formulas from the following web site: http://softpixel.com/~cwright/programming/colorspace/yuv/ Hopefully this person has some accurate formulas :). Basically you can plug numbers from 0 to 255 in the RGB side to mix colors and press the "rgb2yuv" button to see what it looks like and fill in the YUV textboxes with the YUV values that represent the RGB. Or you can go the other way plugging numbers into the YUV part and push the "yuv2rgb" button to see what RGB this would create and change the color of the box to show what this YUV combination would look like.

On a related note, I have example programs in C and SIMD Assembly for converting yuv images to rgb on my SSE Image Processing page.

Related Projects @mikekohn.net

Graphics: SSE Image Processing, GIF, TIFF, BMP/RLE, JPEG, AVI, kunzip, gif2avi, Ringtone Tools, yuv2rgb, RTSP
Red
Green
Blue
Y
U
V

Copyright 1997-2018 - Michael Kohn