Questions tagged [grayscale]

For questions regarding Grayscale, a Bootstrap theme.

890 questions
631
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
  • 6,712
  • 3
  • 16
  • 8
262
votes
7 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 the grayscale because I want to draw on top of the image with color. I read in the image and…
Ryan
  • 3,877
  • 5
  • 27
  • 32
89
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,720
  • 4
  • 22
  • 27
63
votes
7 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,097
  • 5
  • 28
  • 52
62
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,659
  • 3
  • 18
  • 24
60
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:…
leparlon
  • 2,584
  • 2
  • 15
  • 31
59
votes
6 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
  • 6,986
  • 9
  • 42
  • 60
51
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
  • 2,813
  • 4
  • 18
  • 22
46
votes
3 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,054
  • 3
  • 20
  • 31
46
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
  • 735
  • 1
  • 9
  • 12
37
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,109
  • 1
  • 12
  • 30
36
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
  • 73,317
  • 142
  • 374
  • 539
28
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
  • 623
  • 1
  • 6
  • 20
24
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
  • 18,168
  • 44
  • 141
  • 240
24
votes
8 answers

How to convert a PDF to grayscale from command line avoiding to be rasterized?

I'm trying to convert to grayscale this PDF: https://dl.dropboxusercontent.com/u/10351891/page-27.pdf Ghostscript (v 9.10) with pdfwrite Device fails with a "Unable to convert color space to Gray, reverting strategy to LeaveColorUnchanged."…
Panda
  • 265
  • 1
  • 2
  • 7
1
2 3
59 60