rgb

Possible to draw in YCbCr in Java?

Hi everyone, I've a project at the moment, in Java, which uses a filetype which is inherently in the YCbCr colorspace. Within this, there is a lot of number crunching happening behind the scenes (which I've had to code) to convert to RGB from the YCbCr values. This is done per-pixel, per-frame, at 25 frames per second... The project mu...

Formula to determine brightness of RGB color

I'm looking for some kind of formula or algorithm to determine the brightness of a color given the RGB values. I know it can't be as simple as adding the RGB values together and having higher sums be brighter, but I'm kind of at a loss as to where to start. ...

How do I reduce a bitmap to a known set of RGB colours

For a hobby project I'm going to build a program that when given an image bitmap will create a cross-stitch pattern as a PDF. I'll be using Cocoa/Objective C on a Mac. The source bitmap will typically be a 24bpp image, but of the millions of colours available, only a few exist as cross-stitch threads. Threads come in various types. DMC...

using jpeglib for JPEG compressed byte stream

Hello all, I have JPEG compressed byte stream stored in a variable called "Image" and I want to convert this byte stream to RGB. Eg: unsigned char *Image; My question is: Is there any way to pass "Image" to jpeg_stdio_src() to get the RGB color values? Can anyone tell me how I could use jpeglib library to get RGB from byte stream "I...

Background-color hex to JavaScript variable (jQuery)

I'm kind of new to JavaScript and jQuery and now I'm facing a problem: I need to post some data to PHP and one bit of the data needs to be the background color hex of div X. jQuery has the css("background-color") function and with it I can get RGB value of the background into a JavaScript variable. The CSS function seems to return a s...

What is the best way to average two colors that define a linear gradient?

If I have two colors defined by their RGB values, can I average the Red, Green and Blue values and then combine to define a third color that looks like a visual average of the two? ie NewColor = (R1+R2)/2,(G1+G2)/2,(B1+B2)/2 EDIT1: Thanks for all the responses. For my current needs, I am only dealing with color pairs that are shades o...

How to create a bmp file from byte[] in C#

Hello, I have a byte[] array received in TCP Client.The array contains a 24-bit RGB Bitmap file.How to create that bitmap file with given Width ,Height and data? In C++ I use this int WriteBitmapFile(const char *filename, int width, int height, unsigned char *imageData) { FILE *filePtr; // file pointer BITMAPFILEHEA...

Taking an RGB color and normalizing it with UIColor on the iPhone

Hey all, I'm looking for a straight forward way to convert a color from RGB, grabbing it from a tool like Photoshop, then convert it to a UIColor. Since UIColor uses normalized gamut of 0.0 to 1.0 for each color space, I'm not sure how this is done. Thanks for the solution. ...

converting bytestream to RGB using libjpeg

I intercept a packet and extract the payload. This payload is compressed jpeg bytestream data (for example this data is assigned to unsigned char *payload). I know that if I have a FILE pointer, then I can use libjpeg library to extract image information. My question is there a way to pass my pointer(*payload) to the libjpeg functions to...

How is the organization of the 12 Bit RGB color format?

Hello, I know that the 12 bit RGB color pallette format , has 4 bit for each color R,G,B. But how is the structure of the raw data i.e. 1.) Does each color have a byte corresponding to it which in turn has 4 padding bits , and 4 data bits for color data or 2.) Its a packed format , i.e. Byte-1= (padding bits + 4-Rbits) Byte-2 = ...

Convert grayscale value to RGB representation?

Hello, How can I convert a grayscale value (0-255) to an RGB value/representation? It is for using in an SVG image, which doesn't seem to come with a grayscale support, only RGB... Note: this is not RGB -> grayscale, which is already answered in another question) ...

How to get CMYK value for a given PMS value?

Hi I have a PMS(Pantone Matching System) color value. I need to find the corresponding CMYK(http://en.wikipedia.org/wiki/CMYK) or RGB values for that PMS value. Any links that cite the conversion or a color chart would help. cheers ...

How do I convert RGB into HSV in Cocoa Touch?

I want to set the background color of a label using HSV instead of RGB. How do I implement this into code? Code: //.m file #import "IBAppDelegate.h" @implementation IBAppDelegate @synthesize label; { self.label.backgroundColor = [UIColor colorWithRed:1.0f green:0.8f ...

How to calculate the average rgb color values of a bitmap

In my C# (3.5) application I need to get the average color values for the red, green and blue channels of a bitmap. Preferably without using an external library. Can this be done? If so, how? Thanks in advance. Trying to make things a little more precise: Each pixel in the bitmap has a certain RGB color value. I'd like to get the averag...

How to display a raw YUV frame in a Cocoa OpenGL program

Hello everyone, I have been assigned wit the task to write a program that takes a sample raw YUV file and display it in a Cocoa OpenGL program. I am an intern at my job and I have little or no clue how to start. I have been reading wikipedia & articles on YUV, but I couldn't find any good source code on how to open a raw YUV file, ext...

How to read and modify the colorspace of an image in c#

I'm loading a Bitmap from a jpg file. If the image is not 24bit RGB, I'd like to convert it. The conversion should be fairly fast. The images I'm loading are up to huge (9000*9000 pixel with a compressed size of 40-50MB). How can this be done? Btw: I don't want to use any external libraries if possible. But if you know of an open sourc...

Need help with YUV display in OpenGl

I am having trouble displaying a raw YUV file that it is in NV12 format. I can display a selected frame, however, it is still mainly in black and white with certain shades of pink and green. Here is how my output looks like Anyways, here is how my program works. (This is done in cocoa/objective-c, but I need your expert advice on pro...

alpha + RGB -> ARGB ?

In as3, is there a utility or function to convert an RGB color (e.g. 0xFF0000) and an alpha value (e.g. .5) into a A 32-bit ARGB value? And from ARGB to RGB + alpha? Some explanation: a bitmapdata can take an ARGB value in its constructor, but filling shapes in sprites usually takes RGB values. I would like the aforementioned utilitie...

Are there any good reasons for using hex over decimal for RGB colour values in CSS?

rgb(255,255,255) notation has been available since CSS1. But #fffff seems to be vastly more popular. Obviously it's slightly more compact. I know that hex is more closely related to the underlying bytes, and understand that there would be advantages in carrying out arithmetic on those values, but this isn't something you're going to do ...

Converting JPEG colorspace (Adobe RGB to sRGB) on Windows (.Net)

I need to generate thumbnail and medium sized images from large photos. These smaller photos are for display in an online gallery. Many of the photographers are submitting JPEG images using Adobe RGB. I would like to use sRGB for all thumbnails and medium size images I am using dotnet (asp.net) and need a way to convert from Adobe RG...