Questions tagged [grayscale]

For questions regarding Grayscale, a Bootstrap theme.

grayscale
Filter by
Sorted by
Tagged with
667 votes
25 answers
488k views

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 ...
Ken's user avatar
  • 7,082
316 votes
9 answers
673k views

Display image as grayscale

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 ...
Ryan's user avatar
  • 4,567
101 votes
5 answers
305k views

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, ...
Meta's user avatar
  • 1,850
80 votes
8 answers
90k views

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:...
egor7's user avatar
  • 4,824
69 votes
5 answers
184k views

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-...
bluantinoo's user avatar
  • 1,829
67 votes
3 answers
160k views

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....
elaRosca's user avatar
  • 3,103
66 votes
7 answers
177k views

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("...
0fnt's user avatar
  • 8,441
65 votes
5 answers
87k views

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: http://www.mail-...
paulonogueira's user avatar
61 votes
4 answers
138k views

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, ...
Steve's user avatar
  • 2,794
49 votes
2 answers
162k views

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 ...
user1319603's user avatar
41 votes
3 answers
62k views

Android : Converting color image to grayscale [duplicate]

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(); ...
Priska Aprilia's user avatar
39 votes
3 answers
38k views

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 ...
Richard Knop's user avatar
  • 82.3k
32 votes
7 answers
34k views

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: ...
Dliix's user avatar
  • 718
31 votes
3 answers
55k views

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 ...
Steven's user avatar
  • 19.3k
26 votes
6 answers
128k views

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 -> ...
Rabarberski's user avatar
  • 24.4k
25 votes
9 answers
36k views

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, ...
Panda's user avatar
  • 275
25 votes
3 answers
62k views

CSS filter grayscale image for IE 10

Is there a way to make grayscale image filter work on IE 10 without JavaScript or SVG? I've been using the following code successfully in all browsers except IE 10. img{ filter:url("data:image/svg+...
Wissam Abyad's user avatar
24 votes
2 answers
17k views

Is it possible to turn an entire webpage to grayscale using CSS?

I would like to turn an entire website to grayscale. Of course, I can manually edit the CSS and adjust every single color, background-color & co. property, and I can adjust every single image in ...
Golo Roden's user avatar
  • 145k
24 votes
2 answers
21k views

What grayscale conversion algorithm does OpenCV cvtColor() use?

When converting an image in OpenCV from color to grayscale, what conversion algorithm is used? I tried to look this up in the source code on GitHub, but I did not have any success. The lightness ...
Steve's user avatar
  • 2,794
18 votes
3 answers
44k views

how to make smooth grayscale on hover using CSS

I have logo in my website, it is grayscaled on hover i want it to be colored smoothly. it is working but not smoothly. i am using CSS transition. This is my code <img alt="TT ltd logo" src="./img/...
Maria's user avatar
  • 303
18 votes
2 answers
18k views

Convert JPG image from grayscale to RGB using imagemagick

I am trying to convert gray scale images to RGB using the imagemagick command-line tools. It is working fine for PNG images, using: convert image.png -define png:color-type=2 result.png (taken from ...
NotYanka's user avatar
  • 537
17 votes
2 answers
44k views

Python Pil Change GreyScale Tif To RGB

I have a greyscale TIF File. I need to convert it to RGB/ read from it in a way I can work with it. img = Image.open(GIF_FILENAME) rgbimg = img.convert('RGB') for i in range(5): print rgbimg....
1478963's user avatar
  • 1,198
17 votes
2 answers
32k views

CSS filter grayscale not working in Firefox

I'm having troubles doing a transition from grayscale to colored, it works in chrome, but that is it. Here is the HTML: <div id="post" style="background-image:url('bg.png');background-repeat:no-...
sunshinekitty's user avatar
15 votes
2 answers
16k views

Python numpy subtraction no negative numbers (4-6 gives 254)

I wish to subtract 2 gray human faces from each other to see the difference, but I encounter a problem that subtracting e.g. [4] - [6] gives [254] instead of [-2] (or difference: [2]). print(type(...
NumesSanguis's user avatar
  • 6,052
14 votes
4 answers
14k views

Is it possible to have black and white and color image on same window by using opencv?

Is it possible to have black-and-white and color image on same window by using opencv libraray? How can I have both of these images on same window?
user avatar
14 votes
4 answers
26k views

Convert a QImage to grayscale

I have a QImage and I need to convert it to grayscale, then later paint over that with colors. I found an allGray() and isGrayScale() function to check if an image is already grayscale, but no ...
sashoalm's user avatar
  • 77.1k
14 votes
5 answers
18k views

how to read a png file in color and output as gray scale using the Go programming language?

How do I read in a color .png file in the Go programming language, and output it as an 8-bit grayscale image?
mlbright's user avatar
  • 2,191
14 votes
3 answers
19k views

display two png images simultaneously using pylab

I want to open two png image files and display them side by side for visual comparison. I have this code for opening one png file (which I got from unutbu on stackoverflow.com): import numpy as np ...
balibakbar's user avatar
13 votes
1 answer
17k views

Converting RGBA image to Grayscale Golang

I'm currently working on a program to convert and RGBA image to grayscale. I asked a question earlier and was directed to the following answer - Change color of a single pixel - Golang image Here is ...
benjano's user avatar
  • 379
12 votes
4 answers
64k views

Turning a Large Matrix into a Grayscale Image

I have a NumPy array of 3,076,568 binary values (1s and 0s). I would like to convert this to a matrix, and then to a grayscale image in Python. However, when I try to reshape the array into a 1,538,...
user avatar
12 votes
4 answers
44k views

Conversion to grayscale using emguCV in C#

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 ...
Amal's user avatar
  • 1,425
12 votes
2 answers
12k views

Ghostscript color detection

I seem to be unable to find whether Ghostscript is able to simply detect whether job is color or grayscale. I use Ghostscript for conversion of print jobs to PNG, but I also need to have information ...
Martinecko's user avatar
  • 1,819
12 votes
1 answer
10k views

Image conversion to Grayscale using ImageMagick is very dark

I converted a bunch of "normal" JPG photos via convert infile -colorspace Gray outfile to monochrome. However the result is for all images very dark. Here a sample conversion: original photo and ...
halloleo's user avatar
  • 9,734
12 votes
3 answers
20k views

16 bit grayscale png

I'm trying to write (using libpng) an 16-bit grayscale image where each point color equals to sum of its coordinates. The following code should produce a 16-bit PNG, but instead produces 8-bit like ...
Yagg's user avatar
  • 125
11 votes
2 answers
15k views

How can I grayscale a canvas image in JavaScript?

I have an image inside of an HTML5 canvas with the size of 28x28 pixels. I get the imageData of the canvas as an array of RGBA (red, green, blue, alpha) values using this code: canvas = document....
Tom's user avatar
  • 161
11 votes
2 answers
64k views

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?
user198729's user avatar
  • 62.7k
11 votes
2 answers
4k views

How to turn ImageIcon to gray on Swing

I would like to know if there is some way in Swing to turn an ImageIcon to gray scale in a way like: component.setIcon(greyed(imageIcon));
Alfergon's user avatar
  • 5,661
11 votes
1 answer
8k views

Set individual pixels in .NET Format16bppGrayScale image

I'm trying to render a small Bitmap in memory with .NET that needs to be 16 bit Grayscale. The bitmap's format is set to PixelFormat.Format16bppGrayScale. However, Bitmap.SetPixel takes a Color ...
Eric J.'s user avatar
  • 149k
10 votes
7 answers
57k views

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 ...
Nathan Fellman's user avatar
10 votes
2 answers
5k views

Use python wand to grayscale image

I want to use the Python API binding for ImageMagick http://wand-py.org to directly manipulate images. I am however not able to deduce from the documentation how to use a grayscale transformation. Can ...
user2075719's user avatar
10 votes
6 answers
5k views

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 ...
Dave's user avatar
  • 1,721
10 votes
2 answers
32k views

openCV - draw color contours on greyscale image

I'm working on a segmentation algorithme for medical images and during the process it must display the evolving contour on the original image. I'm working with greyscale JPEG. In order to display the ...
alvinleetya's user avatar
10 votes
3 answers
6k views

Counting colonies on a Petri dish

I have a bunch of Petri dishes full of dots which I'd like to count in Matlab. Can this be done reliably and in batches? E.g. This plate has 352 colonies I've tried ImageJ but need to do quite a ...
HCAI's user avatar
  • 2,233
10 votes
4 answers
20k views

Grayscale image with CSS on Safari 5.x

I am trying to show some images on a page where they should be shown in grayscale, except on mouse hover when they smoothly transition into color. I've made it work nicely on IE, Chrome and Firefox, ...
alexg's user avatar
  • 3,015
9 votes
4 answers
46k views

Convert HSV to grayscale in OpenCV

I'm a newbie in OpenCV. I'm learning the Segmentation by Watershed algorithm and I have a problem. I have to convert the image color to grayscale for using Watershed. When I use the BGR color space, ...
Amateur's user avatar
  • 160
9 votes
1 answer
7k views

ImageMagick Reduces Colorspace to Gray

I convert RGB and CMYK TIFF images to RGB JPEGs using convert a.tif -colorspace rgb a.jpg If the TIFF image contains only gray pixels, the colorspace of the resulting JPEG is gray, not RGB. How can ...
Christoph Walesch's user avatar
9 votes
1 answer
19k views

Image does not load as grayscale (skimage)

I'm trying to load an image as grayscale as follows: from skimage import data from skimage.viewer import ImageViewer img = data.imread('my_image.png', as_gray=True) However, if I check for its ...
rdv's user avatar
  • 706
9 votes
2 answers
6k views

MonoTouch convert color UIImage with alpha to grayscale and blur?

I am trying to find a recipe for producing a a blurred grayscale UIImage from a color PNG and alpha. There are recipes out there in ObjC but MonoTouch does not bind the CGRect functions so not sure ...
Sheldon Hage's user avatar
9 votes
2 answers
5k views

How to create Bitmap from grayscaled byte buffer image?

I am trying to get frame image to process while using new Android face detection mobile vision api. So I have created Custom Detector to get Frame and tried to call getBitmap() method but it is null ...
rcmalli's user avatar
  • 357
8 votes
1 answer
22k views

BufferedImage - getting the value of a pixel in grayscale color model picture

I have an BufferedImage transformed to grayscale using this code. I usually got the pixel values by BufferedImage.getRGB(i,j) and the gor each value for R, G, and B. But how do I get the value of a ...
Kajzer's user avatar
  • 2,246

1
2 3 4 5
20