Convert 16bit to 8bit Tifs (Hope to Batch)

7689
15
08-25-2010 06:33 AM
City_ofNorth_Bay
Occasional Contributor
The Export Raster Data Tool (accessed through right click - Data - Export Data in ArcView) allows the user to select the "Use Renderer" option. This option seems to convert my 16bit tifs into 8bit tifs properly. Problem is I cannot use this tool in a Model to repeat it multiple times.

Any Ideas?
Thanks in advance.
0 Kudos
15 Replies
CarrieDavis
Deactivated User
Hi Leusink, 

What version and license level, ex. ArcView, Editor or Info of the software are you working with? As of version 10, Copy Raster will not rescale the data value range.  This option is available as of 10.1.   If you are working with data for example that has a valid pixel range of 0-1116, this range will be cut off at 255 if you set the pixel Type to 8 bit unsigned. You will need to rescale your data first. There are methods available to rescale your data depending on the version, license level, and extensions . As of version 10, with ArcEditor or Info you have the option to use a mosaic dataset to set your imagery to 8 bit. Would you mind elaborating on the compatibility issue and the purpose for converting the 16 bit imagery to 8 bit?  Thank you.

Carrie
0 Kudos
EricRice
Esri Regular Contributor
Here is the forumula to rescale your data.

rescaled grid = [(grid - min value from grid) * (max scale value - min scale value) / (max value from grid - min value from grid)] + min scale value


-Eric
0 Kudos
StephanieLeusink
Occasional Contributor
I have access to both ArcView and ArcInfo levels of 9.3, along with Spatial Analyst.  We are in the process of getting ArcGIS 10, but it has not been rolled out by our IT department.  I do have access to a machine with 10, but I can't heavily rely on it yet, so the new mosaic dataset isn't a solution quite yet.

Eric, I tested the formula you gave me, and it produces results that are almost idential to what the Export Dialog produces.  The only differences are from rounding because the export dialog produced an 8bit unsigned integer tiff and therefore cannot contain decimals.  That leads me to believe that the Export Dialog does in fact rescale the imagery correctly.
0 Kudos
suzannegunn2
New Contributor
Here is the forumula to rescale your data.

rescaled grid = [(grid - min value from grid) * (max scale value - min scale value) / (max value from grid - min value from grid)] + min scale value


-Eric


Hi Eric,

How/where can I use this formula to "batch convert" hundreds of TIFFs?

Thanks!
Suzanne
0 Kudos
EricRice
Esri Regular Contributor
Suzanne,

You can use Python scripting and/or the Raster Calculator to perform map algebra.  For multiband data you must do the math on each band then recomposite them back into a new multiband raster using the Composite Bands tool.  If you can wait for 10.1 (tentatively shipping June 7th) you can just run the Copy Raster tool in a loop using the new option "Scale Pixel Values".

Best,
Eric
0 Kudos
EricRice
Esri Regular Contributor
I have access to both ArcView and ArcInfo levels of 9.3, along with Spatial Analyst.  We are in the process of getting ArcGIS 10, but it has not been rolled out by our IT department.  I do have access to a machine with 10, but I can't heavily rely on it yet, so the new mosaic dataset isn't a solution quite yet.

Eric, I tested the formula you gave me, and it produces results that are almost idential to what the Export Dialog produces.  The only differences are from rounding because the export dialog produced an 8bit unsigned integer tiff and therefore cannot contain decimals.  That leads me to believe that the Export Dialog does in fact rescale the imagery correctly.


Stephanie,

Carrie and I have been doing some testing and in 10.0 and in 10.1 we are not getting results from Data Export that are the result of the formula.  We did not test 9.3 though.  If I can back up for one second to clear the 'screenshot' comment up - For single band data like an elevation layer, the Use Renderer option is essentially the 'screenshot' I mentioned.  For multiband, the image is in 8 bit space for monitor display, which is why you get an 8 bit output when choosing that option- and no it is not a 'screenshot'.  Very sorry for confusing that earlier.

I'm interested in knowing what bands are displayed at the time of export.  What stretch is being used?   What sensor did this data come from?  Carrie and I have been testing WorldView2 data.  If you haven't already exported your rasters manually, please see my comment above (to Suzanne) for how to do it in batch.  Since you're on 9.3, Python is your route (See SOMA tool) since the raster calculator is not a geoprocessing tool in that version.

Best Regards,
Eric
0 Kudos