Convert 1791 TIF to JPG

TekdanTekdan Global Mapper UserPosts: 13
edited March 2010 in Technical Support
Hello
It's my first post here. I try to search for my question but i can't find... for the moment. Second, sorry if my english is not good... i'm a french canadian:D

Global Mapper 9.02
Question about script : I have 1791 tif file with TAB et TFW file. Because of the size of the TIF (600 meg each), i want to export all the file in JPG format (around 30 meg). I don't want to do this one by one. Is there a way to do this in a script? I don't change the size of the pixel and the projection.

Another question. When i try to change the projection, GM ask me the convert from format and the convert to format. After, the batch convert window appear. I have TIF file and i don't find the TIF format in the convert from window. Do I do something wrong?

Thank you everyone

Dan

Comments

  • Roger EdrinnRoger Edrinn Global Mapper User Posts: 721Trusted User
    edited March 2010
    Welcome to the forum Dan, your English is just fine, much better than my French.

    You could try IrfanView, Free, it has a TIFF to JPEG batch converter. However, because these are GeoReferenced files I don't know if that is retained, worth a try.
  • TekdanTekdan Global Mapper User Posts: 13
    edited March 2010
    Hi!
    Like you say, i try with IrfanView but a TIF of 600meg is to big for the software! :(

    Dan
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited March 2010
    Dan,

    I would use the File->Batch Convert/Reproject menu command. The input format is called GeoTIFF, so you'll find it with the G's and not the T's.

    In v9 to do this with a script you would have to have a separate command for each conversion, but in v10 and later there is directory looping support in the script command via the DIR_LOOP_START and DIR_LOOP_END commands that would also allow you to easily do this with a script.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • MattMatt Global Mapper User Posts: 176Trusted User
    edited March 2010
    One other suggestion.

    Check TIFF files to see if they use LZW compression. Or perhaps change to 8 bit instead of 32 bit if there are not a lot of colors. Often you can reduce size significantly without having to use lossy compression like JPG. Or you might try JPG2000, which works much better than JPG in most situations.
  • TekdanTekdan Global Mapper User Posts: 13
    edited March 2010
    Hi!
    Mike : I think i will upgrade my version. I have to check with our IT for the purchase.

    Matt : Your right but (there's always a BUT!) a part of my job is to clip an orthophoto for my collegue who works with Autocad. And now we have some problem to insert "GEO image" in the software and the 2009 version doesn't take some format like ECW and JP2 (i'm not sure for the JP2!) or it's difficult to do!!!

    I think the easy way is to buy the last version. But i will return here because i'm not the best guy to write a script!!!

    Thank's everybody for your help

    Dan
  • GeoGeo Global Mapper User Posts: 92Trusted User
    edited March 2010
    did you try ERDAS ECW Plug-ins ?
    AutoCAD 2007 / 2008 / 2009 + AutoCAD Map (3D) 2008 / 2009 ECW JPEG 2000 plug-in 2.3 exe.gif Login or Register to Download
    Last Updated: 2010-01-13
    Version: 2.3 Beta
    Standard Features
    Supports for AutoCAD 2007
    Supports for AutoCAD 2008 x86 and x64
    Supports for AutoCAD 2009 x86 and x64
    New Features
    Support for AutoCAD Map 2008 / 2009
    Fixes a number of issues with AutoCAD 2009 SP1
    Details
    Operating Systems Supported: Windows 2000, Windows XP
    Hardware Requirements: Standard PC
    Release Date: 30 July 2008
    Download Size: 52.7 MB
  • TekdanTekdan Global Mapper User Posts: 13
    edited March 2010
    Heu! No!
    I will transfer this information to our help desk. I'm not a CAD user. I'm a very part time CAD user. I'm a GIS specialist :rolleyes:
  • TekdanTekdan Global Mapper User Posts: 13
    edited March 2010
    Hello again

    Like Mike said, i bought the last version 11.02. He's a good salesman:)
    Now, the question is the same. How can i convert all my 1791 orthophotos TIFF file (600 meg each) to JPG in a batch file (or script)? I looked in the help and try to find what Mike wrote (DIR_LOOP_START...). Maybe i don't look at the right place!!!!

    Matt : I try to convert TIFF with LZW compression and your right, my file pass from 600 meg to 130 meg. But with JPG, 34 meg. I know real geoimage professionnal doesn't like this format but i did some test and there is not a lot of difference in the quality. And for what we do with the image, it's OK with the JPG. If you have a different opinion, just tell me. I'm here to learn...

    Thank you for your help with the script

    Dan
  • TekdanTekdan Global Mapper User Posts: 13
    edited March 2010
    Hello

    I found 3 examples.
    Is my script is OK.

    GLOBAL_MAPPER_SCRIPT VERSION=1.00
    UNLOAD_ALL

    // Loop over all TIF files in a folder and convert them
    DIR_LOOP_START DIRECTORY="C:\temp\orthophoto\"

    // Create a JPEG file using the EXPORT_RASTER command. Also create a world file
    // and a projection file to make it easier to load in other places.
    EXPORT_RASTER FILENAME="%DIR%"
    TYPE=JPEG GEN_WORLD_FILE=YES GEN_PRJ_FILE=YES

    // Unload the file
    Unload all

    DIR_LOOP_END

    I'm not sure what to write in the line EXPORT RASTER FILENAME=%DIR%.

    Thank you for your help

    Dan
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited March 2010
    Dan,

    I would suggest modifying your script as following to just convert all *.tif files to a new file with the same name and a .jpg extension:

    GLOBAL_MAPPER_SCRIPT VERSION=1.00
    UNLOAD_ALL

    // Loop over all TIF files in a folder and convert them
    DIR_LOOP_START DIRECTORY="C:\temp\orthophoto\" FILENAME_MASKS="*.tif"

    // Create a JPEG file using the EXPORT_RASTER command. Also create a world file
    // and a projection file to make it easier to load in other places.
    EXPORT_RASTER FILENAME="%DIR%%FNAME_WO_EXT%.jpg"
    TYPE=JPEG GEN_WORLD_FILE=YES GEN_PRJ_FILE=YES

    // Unload the file
    UNLOAD_ALL

    DIR_LOOP_END
  • TekdanTekdan Global Mapper User Posts: 13
    edited March 2010
    Hello

    I have this message:
    Removed all loaded overlays.
    Starting loop over all files in directory...
    ERROR: Missing TYPE value in EXPORT_RASTER command.
    ERROR: Missing or unknown TYPE parameter for EXPORT_RASTER command.
    WARNING: Unknown command <TYPE=JPEG> ignored.
    Removed all loaded overlays.
    ERROR: Missing TYPE value in EXPORT_RASTER command.
    ERROR: Missing or unknown TYPE parameter for EXPORT_RASTER command.
    WARNING: Unknown command <TYPE=JPEG> ignored.
    Removed all loaded overlays.
    Loop over files in directory completed.
    Script processing COMPLETED.

    The only thing i change in your script, i add \test for the directory and i have 2 TIFF files. I want to test the spead!

    Thank you

    Dan
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited March 2010
    Dan,

    Ah I didn't notice that your EXPORT_RASTER command wrapped to multiple lines. Whenever you have a command that goes to multiple lines you have to end each line with a \ character to indicate that the command continues onto the next line, as follows:

    EXPORT_RASTER FILENAME="%DIR%%FNAME_WO_EXT%.jpg" \
    TYPE=JPEG GEN_WORLD_FILE=YES GEN_PRJ_FILE=YES

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • TekdanTekdan Global Mapper User Posts: 13
    edited March 2010
    Hello Mike

    Sorry, i'm learning.

    Now i have this error message:
    Removed all loaded overlays.
    Starting loop over all files in directory...
    Exporting raster data to file C:\TEMP\ORTHOPHOTO\TEST\06100204F08.jpg...
    ERROR: Data must be loaded for EXPORT_RASTER command.
    Removed all loaded overlays.
    Exporting raster data to file C:\TEMP\ORTHOPHOTO\TEST\06100206F08.jpg...
    ERROR: Data must be loaded for EXPORT_RASTER command.
    Removed all loaded overlays.
    Loop over files in directory completed.
    Script processing COMPLETED.

    Dan
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited March 2010
    Dan,

    Sorry, I didn't notice that you weren't loading anything in your loop. Add the following command after your DIR_LOOP_START line to actually load the current file:

    IMPORT FILENAME="%FNAME_W_DIR%"

    This should load the current file so it will be available to export.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • TekdanTekdan Global Mapper User Posts: 13
    edited March 2010
    Hello

    Evrything works fine.

    Thank you all

    Daniel
    P.S. Next time for another question!;)
Sign In or Register to comment.