3

I have a series of bmp image files containing RGB encoded data. I need to convert all of these images in to their greyscale equivalents. I have considered two approaches for this, both turned out to be insufficient.

1) I tried using IrfanView and Gimp. In both softwares, I was able to load individual images and convert them to greyscale, and save the greyscale image. However, since I have 500 images, this approach is not feasible as neither allows me apply the RGBTogreyscale operation across the entire image series

2) I tried Matlab. However, my files for some reason are not compatible with Matlab. a simple imread in Matlab was not able to load the image files.

imgdata = imread('myimg.bmp')  % gives error saying that 'Bitfield compression not supported'

Any suggestions?

4 Answers4

4

In Irfanview, go to 'File' ยป 'Batch Conversion' (or press the hotkey, B), add all files to be converted, check 'Use advanced options', then click on the 'Advanced' button, and check 'Convert to grayscale', like so:

screenshot of described configuration above

This should allow a batch conversion of multiple bitmap images to grayscale. You can also batch convert to any of the image file formats supported by Irfanview, e.g. BMP, PNG, GIF, JPG, etc.

3

I would recommend Imagemagick. It is a command line utility that is extremely flexible with many supported functions. One of which being converting to greyscale.

See this post for more:

http://www.imagemagick.org/Usage/color_mods/

tl;dr

convert  test.png  -type GrayScale  grey_type.png

To install Imagemagick, there are all sorts of binaries here:

Link

Glorfindel
  • 4,158
ebrious
  • 167
1

Even though there is an accepted answer, thought I would give my 2 cents.

If you just want to convert to grayscale using default conversion method, IrfanView does the job. However, for those who might want to specify exactly how the colors are to be converted to grayscale I thought I will mention the program I use.

It is commercial, but allows one to specify how much Red, Green, and Blue contribute, as well as allows one to use Lightness or Intensity "channels" of other color models like HSL and HSI to achieve conversion: Batch Image Processor In addition it has various options for saving grayscale images: 8-Bit Bitmap, 8-Bit PNG, 8-Bit GIF, and some others. And if you need, it has a host of other image processing functions like brightness, contrast, etc.

So my take is that if you just want to convert to grayscale using some default implementation, use IrfanView, but if you need more flexibility, options, and perhaps want to compose different batch processing actions together, use more professional tool like the one I mentioned.

Fit Nerd
  • 547
0

I just found out about Batch Processing option in IrfanView. Using Batch Processing, I was able to convert all the images in the series to greyscale in one fell swoop. The output greyscale images were of type .PGM.