X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 14 Nov 2006 02:44 PM by  anon
Converting TIFF to ENVI format
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
14 Nov 2006 02:44 PM
    Hi, I have some image files that are .tif files. They are 320x241 the 241st being the header. I need to convert these file images into raw binary files (columns and rows of 1 and 0s) and the accompanying header to be able to work with them. Is there any easy way of doing this in IDL - (I do not have ENVI) Thank You!!

    Deleted User



    New Member


    Posts:
    New Member


    --
    14 Nov 2006 02:44 PM
    "Raw binary files" usually indicates files made of data stored as bytes which may have any kind of interpretation the file-writer sees fit. You then mention "columns and rows of 1s and 0s", which I usually interpret as monchromatic image data - i.e an image with exactly two colors, usually pure black and pure white. Probably, I don't need to know which interpretation is correct to answer your main question here, however. You say you have '.tif' files with 320 columns by 241 rows, the 241st being the header. I have never looked at the specification for the TIFF file format, but I would not think that that specification stores "header information" in a row. Standardized image file formats, like TIFF, GIF, JPEG, etc., generally store most, if not all, of their metadata/header information in the first bytes of the file; the actual data payload usually follows the header. So, I am naturally confused by your description. Perhaps it is no matter, though. What do the commands: IDL> print, query_tiff('my_image.tif', info) IDL> help, info, /STRUCT say about your file. If the first call returns 1, then you should be able to run: IDL> ; To import the image array into IDL IDL> imgData = read_tiff('my_image.tif', ORIENTATION=orientation, /VERBOSE IDL> ; The below assumes that 'orientation' equals 0 and you are happy with that as is. IDL> openw, lun, 'my_raw_binary_image.dat', /GET_LUN IDL> writeu, lun, imgData IDL> free_lun, lun 'my_raw_binary_image.dat' should then contain 320 * 240 bytes (or shorts or longs, depending on the datatype of imgData), with the first 320 bytes/shorts/longs representing the data in the very bottom scan line of the image, the next 320 representing the second-from-bottom scan line, etc. James Jones
    You are not authorized to post a reply.