Questions tagged [grayscale]

For questions regarding Grayscale, a Bootstrap theme.

972 questions
664
votes
25 answers

Convert an image to grayscale in HTML/CSS

Is there a simple way to display a color bitmap in grayscale with just HTML/CSS? It doesn't need to be IE-compatible (and I imagine it won't be) -- if it works in FF3 and/or Sf3, that's good enough for me. I know I can do it with both SVG and…
Ken
  • 7,052
  • 3
  • 18
  • 8
312
votes
9 answers

Display image as grayscale using matplotlib

I'm trying to display a grayscale image using matplotlib.pyplot.imshow(). My problem is that the grayscale image is displayed as a colormap. I need it to be grayscale because I want to draw on top of the image with color. I read in the image and…
Ryan
  • 4,517
  • 7
  • 30
  • 34
99
votes
5 answers

Image Greyscale with CSS & re-color on mouse-over?

I am looking to take an icon that is colored (and will be a link) and turn it greyscale until the user places their mouse over the icon (where it would then color the image). Is this possible to do, and in a way that is IE & Firefox supported?
Meta
  • 1,830
  • 6
  • 24
  • 28
77
votes
8 answers

Convert RGB to Grayscale in ImageMagick command-line

How do I convert a RGB image (3 channels) to a grayscale one, using the (r+g+b)/3 method? I look through an examples page: http://www.imagemagick.org/Usage/color_mods/#grayscale but the desired method: convert test.png -fx '(r+g+b)/3'…
egor7
  • 4,678
  • 7
  • 31
  • 55
70
votes
5 answers

Greyscale Background Css Images

I've searched a lot on the web but I cannot find a cross browser solution to fade a css backgrund image to greyscale and back. The only working solution is to apply CSS3 filter greyscale: -webkit-filter: grayscale(100%); but this works just with…
bluantinoo
  • 1,829
  • 3
  • 19
  • 25
66
votes
7 answers

Convert an image to grayscale

Is there a way to convert an image to grayscale 16 bits per pixel 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…
0fnt
  • 8,211
  • 9
  • 45
  • 62
65
votes
3 answers

Read image grayscale opencv 3.0.0-dev

I am trying to read images directly as black and white. I recently updated my OpenCv version to 3.0.0-dev, and the code that I used before does not work anymore. img = cv2.imread(f, cv2.CV_LOAD_IMAGE_GRAYSCALE) works fine for 2.4 but does not…
elaRosca
  • 3,083
  • 4
  • 21
  • 22
64
votes
5 answers

Convert a Bitmap to GrayScale in Android

I am new to this site, and I come with a question about Android. Is there any way to convert a Bitmap to grayscale? I know how to draw a grayscale bitmap (using canvas operations:…
paulonogueira
  • 2,684
  • 2
  • 18
  • 31
60
votes
4 answers

In OpenCV (Python), why am I getting 3 channel images from a grayscale image?

I am using Python (2.7) and bindings for OpenCV 2.4.6 on Ubuntu 12.04 I load an image image = cv2.imread('image.jpg') I then check the shape of the image array print image.shape I get (480, 640, 3), which I expect for a 640x480 colour…
Steve
  • 2,764
  • 4
  • 27
  • 32
49
votes
2 answers

How can I convert a cv::Mat to a gray scale in OpenCv?

How can I convert a cv::Mat to a gray scale? I am trying to run drawKeyPoints func from opencv, however I have been getting an Assertion Filed error. My guess is that it needs to receive a gray scale image rather than a color image in the…
user1319603
  • 765
  • 1
  • 9
  • 13
41
votes
3 answers

Android : Converting color image to grayscale

I am trying to convert color image into grayscale using the average of red, green, blue. But it comes out with errors. Here is my code imgWidth = myBitmap.getWidth(); imgHeight = myBitmap.getHeight(); for(int i…
Priska Aprilia
  • 1,149
  • 1
  • 15
  • 34
39
votes
3 answers

How can I convert an RGB image to grayscale but keep one color?

I am trying to create an effect similar to Sin City or other movies where they remove all colors except one from an image. I have an RGB image which I want to convert to grayscale but I want to keep one color. This is my picture: I want to keep the…
Richard Knop
  • 81,041
  • 149
  • 392
  • 552
32
votes
7 answers

Convert UIImage to grayscale keeping image quality

I have this extension (found in obj-c and I converted it to Swift3) to get the same UIImage but grayscaled: public func getGrayScale() -> UIImage { let imgRect = CGRect(x: 0, y: 0, width: width, height: height) let colorSpace =…
Dliix
  • 718
  • 1
  • 7
  • 20
30
votes
3 answers

How do I desaturate and saturate an image using CSS?

Update I just realized that the desaturation is only working in Chrome. How do I make it work in FF, IE and other browsers? (Headline changed) I'm converting a color picture to greyscale by following the suggestions here: Convert an image to…
Steven
  • 19,224
  • 47
  • 152
  • 257
27
votes
6 answers

Convert grayscale value to RGB representation?

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…
Rabarberski
  • 23,854
  • 21
  • 74
  • 96
1
2 3
64 65