X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 17 Mar 2015 01:51 AM by  anon
TIFF to ENVI
 3 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
17 Mar 2015 01:51 AM
    Hello, I have hundreds of TIFF files downloaded that I need to convert to ENVI format with a header. Files range from 1-6 bands. Is there an easy way to do this? I tried working up an IDL code but couldn't figure it out-- it seems like there must be an easier way than opening the file in ENVI and clicking "Save As" hundreds of times. Appreciate the help. Cheers, bw

    Deleted User



    New Member


    Posts:
    New Member


    --
    17 Mar 2015 08:43 AM
    You can use ENVI API to convert those files. For example, to convert all TIFF files in a folder to ENVI format, you can use the script below: e = envi() root = Dialog_Pickfile(/DIRECTORY) files = File_Search(root + '*.tif', COUNT=nFiles) rasters = ObjArr(nFiles) for i = 0L, nFiles-1 do begin rasters[i] = e.OpenRaster(files[i]) rasters[i].Export, e.GetTemporaryFilename(), 'ENVI' endfor -Xiaoying

    Deleted User



    New Member


    Posts:
    New Member


    --
    17 Mar 2015 06:40 PM
    Hmmm been tinkering with this for hours and still get this same result with the above code: % Attempt to subscript FILES with I is out of range. % Execution halted at: $MAIN$ % Attempt to subscript RASTERS with I is out of range. % Execution halted at: $MAIN$ The code listed was very similar to that I was trying to write myself, and I got similar error messages. Any ideas?

    Deleted User



    Basic Member


    Posts:228
    Basic Member


    --
    18 Mar 2015 02:30 PM
    Sounds like IDL isn't liking the value of i at some point during the looping. You may want to add some PRINT statements to check the value of nFiles before you start that loop. Maybe you are ending up with a situation where no files are found? - Peg Exelis VIS
    You are not authorized to post a reply.