grayscale

Find most readable colour of text that is drawn on a coloured surface

I'm not sure how to ask this but here goes. I draw a filled coloured rectangle on screen. The colour is in form of R,G,B I then want to draw text on top of the rectangle, however the colour of the text has to be such that it provides the best contrast, meaning it's readable. Example: If I draw a black rectangle, the obvious colour f...

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 implement grayscale rendering in OpenGL?

When rendering a scene of textured polygons, I'd like to be able to switch between rendering in the original colors and a "grayscale" mode. I've been trying to achieve this using blending and color matrix operations; none of it worked (with blending I couldn't find a glBlendFunc() that achieved something remotely resembling to what I wan...

[C#] GrayScale (by ColorMatrix) causes OutOfMemoryException. Why ?

I have 2 forms, A and B. On the Form A, I click a button and an Image is being loaded to a PictureBox located ona the Form B. And, I want to set GrayScale to this image by: public void SetGrayScale(PictureBox pb) { ColorMatrix matrix = new ColorMatrix(new float[][] { new float[] {0.299f, 0.299f, 0.299f...

Using javascript to show a grey-scale version of an image on mouse-over

I need a way to display a grayscale version of an image on mouse-over. I've seen this implemented using the Canvas functionality of the browser but don't want to use that method as it will be a while before canvas is implemented on all browsers. Has anyone done such a thing? ...

How can I convert a color image to grayscale in MATLAB?

I am trying to implement an algorithm in computer vision and I want to try it on a set of pictures. The pictures are all in color, but I don't want to deal with that. I want to convert them to grayscale which is enough for testing the algorithm. How can I convert a color image to grayscale? I'm reading it with: x = imread('bla.jpg')...

Detecting grayscale images with .Net

I am scanning documents to JPG images. The scanner must scan all pages as color or all pages as black and white. Since many of my pages are color, I must scan all pages as color. After the scanning is complete, I would like to examine the images with .Net and try to detect what images are black and white so that I can convert those im...

PHP: Converting png's and gif's into grayscale

Hello, im using the following script to convert jpgs into grayscale-images. http://bubble.ro/How_to_convert_an_image_to_grayscale_using_PHP.html i want to upgrade it to also convert pngs (with transparency) and gifs (with transparency) into grayscale images. At the moment it's not working. I'm querying the image-src for its file-extens...

C#, convert image to grayscale

Is there a way to convert an image to grayscale 16pixels per bit format, rather than setting each of the r,g and b components to luminance. I currently have a bmp from file. Bitmap c = new Bitmap("filename"); I want a Bitmap d, that is grayscale version of c. I do see a consructor that includes System.Drawing.Imaging.PixelFormat, but...

Converting rgb images to grayscale and renaming them using matlab

Hello, I have 500 images named Image1.tif all the way to Image500.tif and I need to convert all of them to grayscale and save them as Image1A.tif to Image500A.tif. Is there a quick way to do this? Thank you. ...

J2ME: Convert transparent PNG image to grayscale

Hello, is there any possiblity in J2ME to convert an image (loaded from a png file with alpha) to a new transparent grayscale image? Until now I only got the rgb values, but not the alpha. Thanks. Edit: yes, it should be 32 bit grayscale. ...

Is it possible to make a grayscale BMP file?

Hello. I am trying to make a program that outputs a 8-bit grayscale image to bmp file. I have found out that 8-bit BMP files are indexed. Is it possible to omit the color table and just put values instead of indexes in the color table? Or BMP format does not allow this? ...

Choosing colors that convert nicely to greyscale

If I'm designing af tool that must "screenshot" well for printed documentation, can I easily choose colors that look different even when printed in greyscale? EDIT: I was hoping for some easy-to-use palette or tool, but the inputs given already is very insightfull for sure ...

Greyscale Image from YUV420p data

From what I have read on the internet the Y value is the luminance value and can be used to create a grey scale image. The following link: http://www.bobpowell.net/grayscale.htm, has some C# code on working out the luminance of a bitmap image : { Bitmap bm = new Bitmap(source.Width,source.Height); for(int y=0;y<bm.Height;y++) ...

How to convert a grayscale matrix to an RGB matrix in MATLAB?

rgbImage = grayImage / max(max(grayImage)); or rgbImage = grayImage / 255; Which of the above is right,and reason? ...

convert color image into black and white image using php gd library

hi i m having a page in which users upload their images to convert into black and white image.. i tried some of the code from internet but it works only for jpeg image when i upload some gif or png images it shows an full black image or the same image with the same color scale... any codes appreciated.. regards vijay. ...

Converting a number to a greyscale color in Java

Hi, I'm trying to figure out how I can convert a number between 1 and 50 to a greyscale color that could be used here: g.setColor(MyGreyScaleColour); 1 would be lightest (white) and 50 would be darkest (black). e.g. Color intToCol(int colNum) { code here } Any suggestions? ...

Problem with grayscale image

Hey, When I try to show a grayscale image using : Img = imread('tr2.png'); subplot(111); imshow(Img); it does not appear as the original image. Where is the problem ? ...

Conversion to grayscale using emguCV in C#

Hi. I am new to EmguCV. I want to convert an rgb image into gray scale. For the conversion I have used the code Image<Gray,byte> grayImage = ColordImage.Convert<Gray, byte>(); Now when i compile this code in C# it gives no error,but when i run it then after a few seconds it gives me the exception at this line of code that this type of...

Grayscale in matlab

I'm trying to convert a 2D array to grayscale but using mat2gray doesn't do anything and imshow() appears to create a binary image that when I graph I cannot rotate it, e.g. the original array is 2d but maps in 3d. So, what is the best way to take a grayscale of 2d array in Matlab so if you have A=rand(5,10) or something and want to take...