> Script Details
Grid to Image Conversion / Georeference / World File Creator
report inappropriate content
Feb 28 2003
Status of work
ArcScripts is intended for the free exchange of scripts and tools related to ESRI software products. Please alert the moderator if this script is a demo, trial-version, or an advertisement for a retail product.
This extension adds three buttons to the View user-interface for converting grids or images to TIFF, JPEG, BSQ, BIP and BIL images; easily georeferencing those images; creating/tweaking image world files in general.
Button #1: Default output settings for the Grid-2-Image (G2I) Converter. You can set the output image type, whether you want to create a shapefile(s) of extent of the output image(s), whether you want to create an image catelogue, and the background color. These settings are kept throughout the ArcView sessions and apply to all conversions, until you change the settings again.
Button #2: The Grid-to-Image conversion is an adaptation of script that Kenneth McVay posted earlier (grid2img.ave, 13 Sept 98). His script offered two options for creating an image: (i) saving a grid as a B/W (gray scale) image that preserves the grid values, and (ii) selecting three the red, green and blue bands as grids and make a new image. I added more options that allows (iii) saving a grid in the actual legend colors, (iv) actual legend colors + hillshade, and (v) direction image-2-image conversion. Images catalogues can also be created, and if you have any graphic selected (circle, rectangle, or poly), the new image will automatically be clipped to the extent of that graphic
Button #3: The Image Reoreferencing/World File Creator tool. Various similar scripts have been posted at Arcscript, and I used some of their code. My tool is different in that it offers a really easy visual way of creating and tweaking the numbers in a world file without any manual calculations or measering distances. I have found this particularly handy for georeferencing scanned images that have few reference points and graticules. The only requirement is that you need to overlay the image with an existing line or polygon shapefile of (roughly) the same region. You can then adjust the world file in a trial-and-error mode until the image perfectly overlays with the shapefile.
System Requirements: This extension requires the Spatial Analyst v1.x and Dialog Designer extensions, which will be automatically loaded as dependencies. In addition, the grid-to-image conversion requires the file ..\Arcview\Ext32\g2i.dll. This file was created by Kenneth McVay, it's the same one as he included with his 9/13/98 ArcScript posting.
1/31/2001. Fixed a missing string-2-filename conversion that resulted in a runtime error under certain conditions.
3/12/2001. Used an improved algorithm to extract the Red, Green and Blue band grids from the current legend colors.
2/27/2003. Posted version 2. Many new features: image-2-image conversion, image catalogues, clipping, and histogram adjustment if the value of manually selected R, G and B bands are outside the 0-255 range (such as in 11-bit IKONOS images).