PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 08 Jan 2019 10:22 AM by  Jim Uba
READ_BMP results in error: % Array dimensions must be greater than 0.
 0 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Jim Uba



New Member


Posts:77
New Member


--
08 Jan 2019 10:22 AM
    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.
    You are not authorized to post a reply.