script SET_BG_COLOR to white for 4band raster imagery not working
Kalika
Global Mapper User
Hi there!
I've got a script which imports 4band tiffs and exports 4band tiffs using a shapefile as an area of interest. All imagery outside the shapefile should have a white background colour, but it is turning out black. This script always works for 3band RGB imagery.
Here is my script:
GLOBAL_MAPPER_SCRIPT VERSION=1.00
UNLOAD_ALL
SET_BG_COLOR COLOR=RGB(255,255,255)
DEFINE_PROJ PROJ_NAME="myProj"
PROJCS["Transverse_Mercator",GEOGCS["GCS_Geographic Coordinate System",DATUM["D_GDA94",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["scale_factor",0.9996],PARAMETER["central_meridian",135],PARAMETER["latitude_of_origin",0],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["Meter",1]]
END_DEFINE_PROJ
LOAD_PROJECTION PROJ_NAME="myProj"
IMPORT FILENAME="M:\11063A_Gove\Imagery\Tiffs_Complete\Gove_e690n8639.tif" TYPE=GEOTIFF \
PROJ_NAME="myProj" \
COLOR_GRADE="1.00,0,255,1,254,0,255,1,254,0,255,1,254" \
SAMPLING_METHOD=BILINEAR CONTRAST_MODE=NONE CLIP_COLLAR=NONE BLEND_MODE=NO_BLEND LOAD_FLAGS="0~0~0~4~0~1"
IMPORT FILENAME="M:\11063A_Gove\Imagery\Tiffs_Complete\Gove_e690n8640.tif" TYPE=GEOTIFF \
PROJ_NAME="myProj" \
COLOR_GRADE="1.00,0,255,1,254,0,255,1,254,0,255,1,254" \
SAMPLING_METHOD=BILINEAR CONTRAST_MODE=NONE CLIP_COLLAR=NONE BLEND_MODE=NO_BLEND LOAD_FLAGS="0~0~0~4~0~1"
IMPORT FILENAME="M:\11063A_Gove\Imagery\Tiffs_Complete\Gove_e692n8637.tif" TYPE=GEOTIFF \
PROJ_NAME="myProj" \
COLOR_GRADE="1.00,0,255,1,254,0,255,1,254,0,255,1,254" \
SAMPLING_METHOD=BILINEAR CONTRAST_MODE=NONE CLIP_COLLAR=NONE BLEND_MODE=NO_BLEND LOAD_FLAGS="0~0~0~4~0~1"
IMPORT FILENAME="M:\11063A_Gove\Imagery\Tiffs_Complete\Gove_e692n8639.tif" TYPE=GEOTIFF \
PROJ_NAME="myProj" \
COLOR_GRADE="1.00,0,255,1,254,0,255,1,254,0,255,1,254" \
SAMPLING_METHOD=BILINEAR CONTRAST_MODE=NONE CLIP_COLLAR=NONE BLEND_MODE=NO_BLEND LOAD_FLAGS="0~0~0~4~0~1"
IMPORT FILENAME="M:\11063A_Gove\Imagery\Tiffs_Complete\Gove_e692n8640.tif" TYPE=GEOTIFF \
PROJ_NAME="myProj" \
COLOR_GRADE="1.00,0,255,1,254,0,255,1,254,0,255,1,254" \
SAMPLING_METHOD=BILINEAR CONTRAST_MODE=NONE CLIP_COLLAR=NONE BLEND_MODE=NO_BLEND LOAD_FLAGS="0~0~0~4~0~1"
EXPORT_RASTER FILENAME="M:\11063A_Gove\Imagery\Delivery_Procedures\02_Clipped_Boosted\MGAz53\I5.TIF" TYPE=GEOTIFF \
GLOBAL_BOUNDS_SIZE="690410,8638100,2010,2010" \
POLYGON_CROP_FILE="P:\11063A_Gove(20946A)\Working\AOI\20946A_Gove_Ortho_Area_MGAZ53_Rev0..shp" \
FORCE_SQUARE_PIXELS=YES SPATIAL_RES=0.15,0.15 GEN_WORLD_FILE=YES GEN_PRJ_FILE=YES COMPRESSION=NONE PALETTE=MULTIBAND NUM_BANDS=4 BAND_BIT_DEPTH=8
UNLOAD_ALL
Any help would be greatly appreciated!
I've got a script which imports 4band tiffs and exports 4band tiffs using a shapefile as an area of interest. All imagery outside the shapefile should have a white background colour, but it is turning out black. This script always works for 3band RGB imagery.
Here is my script:
GLOBAL_MAPPER_SCRIPT VERSION=1.00
UNLOAD_ALL
SET_BG_COLOR COLOR=RGB(255,255,255)
DEFINE_PROJ PROJ_NAME="myProj"
PROJCS["Transverse_Mercator",GEOGCS["GCS_Geographic Coordinate System",DATUM["D_GDA94",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["scale_factor",0.9996],PARAMETER["central_meridian",135],PARAMETER["latitude_of_origin",0],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["Meter",1]]
END_DEFINE_PROJ
LOAD_PROJECTION PROJ_NAME="myProj"
IMPORT FILENAME="M:\11063A_Gove\Imagery\Tiffs_Complete\Gove_e690n8639.tif" TYPE=GEOTIFF \
PROJ_NAME="myProj" \
COLOR_GRADE="1.00,0,255,1,254,0,255,1,254,0,255,1,254" \
SAMPLING_METHOD=BILINEAR CONTRAST_MODE=NONE CLIP_COLLAR=NONE BLEND_MODE=NO_BLEND LOAD_FLAGS="0~0~0~4~0~1"
IMPORT FILENAME="M:\11063A_Gove\Imagery\Tiffs_Complete\Gove_e690n8640.tif" TYPE=GEOTIFF \
PROJ_NAME="myProj" \
COLOR_GRADE="1.00,0,255,1,254,0,255,1,254,0,255,1,254" \
SAMPLING_METHOD=BILINEAR CONTRAST_MODE=NONE CLIP_COLLAR=NONE BLEND_MODE=NO_BLEND LOAD_FLAGS="0~0~0~4~0~1"
IMPORT FILENAME="M:\11063A_Gove\Imagery\Tiffs_Complete\Gove_e692n8637.tif" TYPE=GEOTIFF \
PROJ_NAME="myProj" \
COLOR_GRADE="1.00,0,255,1,254,0,255,1,254,0,255,1,254" \
SAMPLING_METHOD=BILINEAR CONTRAST_MODE=NONE CLIP_COLLAR=NONE BLEND_MODE=NO_BLEND LOAD_FLAGS="0~0~0~4~0~1"
IMPORT FILENAME="M:\11063A_Gove\Imagery\Tiffs_Complete\Gove_e692n8639.tif" TYPE=GEOTIFF \
PROJ_NAME="myProj" \
COLOR_GRADE="1.00,0,255,1,254,0,255,1,254,0,255,1,254" \
SAMPLING_METHOD=BILINEAR CONTRAST_MODE=NONE CLIP_COLLAR=NONE BLEND_MODE=NO_BLEND LOAD_FLAGS="0~0~0~4~0~1"
IMPORT FILENAME="M:\11063A_Gove\Imagery\Tiffs_Complete\Gove_e692n8640.tif" TYPE=GEOTIFF \
PROJ_NAME="myProj" \
COLOR_GRADE="1.00,0,255,1,254,0,255,1,254,0,255,1,254" \
SAMPLING_METHOD=BILINEAR CONTRAST_MODE=NONE CLIP_COLLAR=NONE BLEND_MODE=NO_BLEND LOAD_FLAGS="0~0~0~4~0~1"
EXPORT_RASTER FILENAME="M:\11063A_Gove\Imagery\Delivery_Procedures\02_Clipped_Boosted\MGAz53\I5.TIF" TYPE=GEOTIFF \
GLOBAL_BOUNDS_SIZE="690410,8638100,2010,2010" \
POLYGON_CROP_FILE="P:\11063A_Gove(20946A)\Working\AOI\20946A_Gove_Ortho_Area_MGAZ53_Rev0..shp" \
FORCE_SQUARE_PIXELS=YES SPATIAL_RES=0.15,0.15 GEN_WORLD_FILE=YES GEN_PRJ_FILE=YES COMPRESSION=NONE PALETTE=MULTIBAND NUM_BANDS=4 BAND_BIT_DEPTH=8
UNLOAD_ALL
Any help would be greatly appreciated!
Comments
-
Is it the area outside of the Shapefile that is showing up as black rather than white? Which version of Global Mapper are you using? There were some issues in older versions where multi-band exports always made no-data values 0, but in later ones a grayscale background color (like white = 255 as you have) should generate the expected results.
Thanks,
Mike
Global Mapper Guru
geohelp@bluemarblegeo.com
Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation -
Hi Mike
Yes, the area outside of the Shapefile is showing up as black rather than white.
I'm using Global Mapper version 12 (64 bit). -
Oh I think that's just because in v12 all background multi-band is set to black. If you upgrade to a later version it should maintain the grayscale. You can contact gmorders@bluemarblegeo.com for information about upgrading.
Thanks,
Mike
Global Mapper Guru
geohelp@bluemarblegeo.com
Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation -
Thanks Mike. Would v13 work?
-
While it does look like the change for using grayscale background colors is in v13, I'm not sure that we sell upgrades to v13 anymore. You would probably have to go to the current release (v14.2) or the about to be released v15.
Thanks,
Mike
Global Mapper Guru
geohelp@bluemarblegeo.com
Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
Categories
- 12.7K All Categories
- 5.6K Features Discussion
- 342 Downloading Imagery
- 1.3K Elevation Data
- 380 Georeferencing Imagery Discussion
- 628 GM Script Language
- 53 User Scripts
- 113 GPS Features
- 414 Projection Questions
- 819 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 177 Announcement and News
- 908 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 562 Other Discussion
- 129 GIS Data Sources
- 27 Global Mapper Showcase
- 233 How I use Global Mapper
- 107 Global Mapper Forum Website