PROBLEM: An IDL user was unable to open BMP file with READ_BMP, getting an error like this: IDL> image = read_bmp(file) % Array dimensions must be greater than 0. % Execution halted at: $MAIN$ The same file can be viewed using the MS Photos application and MS Paint. The properties dialog indicate the expected image dimensions. --------------------------------- POSSIBLE SOLUTION: Check the dimensions of the BMP file in IDL using the QUERY_BMP routine, for example: print, query_bmp(file, info) print, info.dimensions If any of the image dimensions is negative (which, as I understand, doesn't comply with BMP image file format specifications) IDL will not be able to successfully open the file. MS Photos and MS Paint may be able to open the file because they applications are more tolerant of non-standard BMP files. A possible workaround to the problem may be to open the BMP file in a tolerant image editing application like MS Paint and then save a copy of the file. Hopefully, this will fix the errant dimension value to allow IDL to read in the image.
|