Message Boards

Convert a batch of RGB images to Grayscale?

I have a few RGB images in a folder which i would like to convert to grayscale.
I have been able to convert them individually but i am unable to convert all the images in the folder at one go.
I have tried to implement ColorConvert and ColorSpace but was unable to convert the complete set of images in one go. I need to convert approximately 2000 images so it is not possible to convert them individually.
I request some help to achieve this task.

had tried that already before posting the question,
I am getting the following error when i do that

ColorConvert::ccvinput: C:\Users\Pushkar\Desktop\validate\test\car\00001.jpg should be a valid image, a color directive, a list of machine-sized real numbers of length up to 3, or a list of such objects.

I get the above error around 5 times and then i get the following error

General::stop: Further output of ColorConvert::ccvinput will be suppressed during this calculation.

There are two problems with this, I would like to get an output of only the descriptors in the form of a jpg and also i would like to write a loop for 2000 images.
I will start a new discussion regarding this but as you are actively solving all my questions, i wanted to ask you directly.

The source of my example is wolfram documentation , Please see the Applications section

I have tried the updated code and have done the exact same thing which you posted but i am still getting an empty folder without anything in it and the kernel is quitting within seconds of evaluating the notebook.