how to grayscale an image in python

how to grayscale an image in python

Hi,

I have may images and it want to greyscale all with python.

can it be done?

how to grayscale an image in python?

Thanks

View Answers

July 22, 2019 at 1:44 AM

Hi,

You can do this with opencv. here is code example:

from PIL import Image
img = Image.open('img.jpg').convert('LA')
img.save("img-gray.png")

Thanks









Related Tutorials/Questions & Answers:
how to grayscale an image in python
how to grayscale an image in python  Hi, I have may images and it want to greyscale all with python. can it be done? how to grayscale an image in python? Thanks   Hi, You can do this with opencv. here is code
ModuleNotFoundError: No module named 'grayscale-image'
named 'grayscale-image' How to remove the ModuleNotFoundError: No module named 'grayscale-image' error? Thanks   Hi, In your python... python with following command: pip install grayscale-image After
Advertisements
PHP GD image grayscale
} } if ($c == ($imgw*$imgh))ADS_TO_REPLACE_8 { echo "The image is grayscale."; }ADS_TO_REPLACE_9 else { echo "The image... will get the following output OUTPUT:The image is NOT grayscale
PHP GD Grayscale
<?php $file = 'images.jpg'; header('Content-type: image/jpeg');ADS_TO_REPLACE_1 list($width, $height) = getimagesize($file); $source = imagecreatefromjpeg($file); $bwimage= imagecreate($width, $height);ADS
ModuleNotFoundError: No module named 'nive_cms_design_bs_grayscale'
: No module named 'nive_cms_design_bs_grayscale' How to remove... library. You can install nive_cms_design_bs_grayscale python with following... of nive_cms_design_bs_grayscale python library, ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'Python-Google_Image_Search'
: No module named 'Python-Google_Image_Search' How to remove the ModuleNotFoundError: No module named 'Python-Google_Image_Search' error? Thanks...ModuleNotFoundError: No module named 'Python-Google_Image_Search'  Hi
ModuleNotFoundError: No module named 'Python-Google_Image_Search'
: No module named 'Python-Google_Image_Search' How to remove the ModuleNotFoundError: No module named 'Python-Google_Image_Search' error? Thanks...ModuleNotFoundError: No module named 'Python-Google_Image_Search'  Hi
ModuleNotFoundError: No module named 'python-image-complete'
: No module named 'python-image-complete' How to remove the ModuleNotFoundError: No module named 'python-image-complete' error? Thanks   Hi...ModuleNotFoundError: No module named 'python-image-complete'  Hi
ModuleNotFoundError: No module named 'python-image-resize'
named 'python-image-resize' How to remove the ModuleNotFoundError: No module named 'python-image-resize' error? Thanks   Hi...ModuleNotFoundError: No module named 'python-image-resize'  Hi, My
ModuleNotFoundError: No module named 'python-image-resize'
named 'python-image-resize' How to remove the ModuleNotFoundError: No module named 'python-image-resize' error? Thanks   Hi...ModuleNotFoundError: No module named 'python-image-resize'  Hi, My
ModuleNotFoundError: No module named 'python-image-complete'
: No module named 'python-image-complete' How to remove the ModuleNotFoundError: No module named 'python-image-complete' error? Thanks   Hi...ModuleNotFoundError: No module named 'python-image-complete'  Hi
ModuleNotFoundError: No module named 'python-image-resize'
named 'python-image-resize' How to remove the ModuleNotFoundError: No module named 'python-image-resize' error? Thanks   Hi...ModuleNotFoundError: No module named 'python-image-resize'  Hi, My
ModuleNotFoundError: No module named 'python-resize-image'
named 'python-resize-image' How to remove the ModuleNotFoundError: No module named 'python-resize-image' error? Thanks   Hi...ModuleNotFoundError: No module named 'python-resize-image'  Hi, My
How to put an image on a JButton?
How to put an image on a JButton?  How to put an image on a JButton
how to update image in php
how to update image in php  how to update image in php
how to insert image into server
how to insert image into server  how to insert an image into sql server and retrieve it using jSP
how to set background image
how to set background image  how to set image in background in that image i want over lay text how it possible in jsp? using flash image how it is overlayed in jsp page? thanks
How to store an image in database
How to store an image in database  Hi........... How to store an image in postgresql using a query. I mean tell me the way to store an image using datatype. I am using the datatype bytea but tell me how to insert the image
How to store image into database
How to store image into database  Hi, all I want to store image into database using Java. Can anyone help me that how can i store image into database... through the following link How To Store Image Into MySQL Using Java
how to display image with listview
how to display image with listview  How can i display the list view with the related images from database
Jmagick how to add image on an existing image
Jmagick how to add image on an existing image  hi, I am using...) on an existing image. can any one explains how ? Thanks.   hi, In Jmagick you... you to understand how to use these methods and values in to adding an image
How to write image in Jmagick
How to write image in Jmagick  hi, I am new in Java I am using the Jmagick library, how can I write an image in Jmagick ? Thanks.   hi, You can try this snippet into your code ImageInfo ii = new ImageInfo("abc.jpg
How to Increase / decrease the contract of an image?
How to Increase / decrease the contract of an image?  How to Increase / decrease the contract of an image
How to Increase / decrease the brightness of an image?
How to Increase / decrease the brightness of an image?  How to Increase / decrease the brightness of an image
how to use image tag in jsp
how to use image tag in jsp  How to use image tag in JSP
how to convert string to image in java
how to convert string to image in java  how to convert string to image in java? I know we need to convert image to a byte array at some point in my application but do not know how to convert a image into byte string. Please
How to write text on image
How to write text on image  hi, I am using the Jmagick library. I want to write text on image, how is it possible ? Thanks.   hi, I am new in Jmagick but, I used the following code and it might also help you
how to set image - EJB
how to set image   public ActionForward execute(ActionMapping mapping... coding to ireport. this coding only getting database fields. i need add one image in this pdf, how can i set pls help me sir, my image in E:/rose.jpg,how can
How to retrieve image from database
How to retrieve image from database  hi........ How to retrieve image from database when it is stored. I have stored image in postgresql and want... but it retrieves as a string and not complete image can u tel me the conversion
how to display the image in center - Ajax
how to display the image in center  i want to dispaly the image as center of the screen using javascript..while i am clicking the button ..any one give me the code for this one
image
image  how to add the image in servlet code
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
Image
Image  how to insert image in xsl without using xml. the image was displayed in pdf..Please help me
How to Store Image using JSF
How to Store Image using JSF  Hi How to upload images in db. using jsf. For jsf photo uploading .. I used this one code for upload image.. But this code haven't option to upload any images . i want to store image in db
image
image   Dear every body please help me how to add and retrive image and video into oracle 11g using jsp
How to save image on the server by applet
How to save image on the server by applet  HI, in my project I am using applet and creating a chart by jcchart. Now when the chart has ploated... as a gif image on the server directory. Can any Body help me how can I do it Thanks
How to save image on the server by applet
How to save image on the server by applet  HI, in my project I am using applet and creating a chart by jcchart. Now when the chart has ploated... as a gif image on the server directory. Can any Body help me how can I do it Thanks
how to show random image in ASP.net?
how to show random image in ASP.net?  hello bros i saw in many websites..there is a programming of random image changing.... i want to use this in my ASP.NET websites, can any one suggest me code or any kind of help..so that i
How to use flickr image in Flex
How to use flickr image in Flex  Hi, I want to diaply the flickr image in my Flex application. Do I need a crossdomain.xml file on flickr? Please let's know how I can develop such applications. Thanks   Ans
How to display image in Swing?
How to display image in Swing Application? Swing is used... requirement to display the image in your swing application then you can learn to display image in swing application here. In this example user enters the name
How to display image in Swing?
How to display image in Swing Application? Swing is used... requirement to display the image in your swing application then you can learn to display image in swing application here. In this example user enters the name
how to set a image in frame? - Swing AWT
how to set a image in frame?  how to set a image in frame using swing
how to use a image in background in your application form?
how to use a image in background in your application form?  how to use a image in background in your application form
how to get the image of a selected JRadioButton to another panel?
how to get the image of a selected JRadioButton to another panel?  how to get the image of a selected JRadioButton to another panel
how to fetch image from mysql using jsp
how to fetch image from mysql using jsp  how to fetch image from mysql using jsp
How to store and retrieve image from database in JSP?
How to store and retrieve image from database in JSP?  Hi, In one of my application I have to store and then display the image in JSP. How to store and retrieve image from database in JSP? Thanks   HI, You can use
How to decrease image thumbnail size in java?
How to decrease image thumbnail size in java?  Hi, I my web application I have to create the thumbnail size image from the image file uploaded by user. How to decrease image thumbnail size in java? Thanks
hello Deepak -how to highlight the area in image
hello Deepak -how to highlight the area in image  how to highlight the specific area in image,when the cursor is at corresponding field's textbox. Here webpage consist of a jpeg image on the top and below that manual fields(text
How to retrieve image from database in Servlet?
How to retrieve image from database in Servlet?  Hi, How to retrieve image from database in Servlet? Thanks   Hi, Please check the tutorial Retrieve image from database using Servlet. Thanks

Ads