Exporting Transparent Geo-Tiff?
Is the Global Mapper SDK able to support the export of Geo-tiff with transparent background?
I am now currently doing it in this manner:
1) Set Background Color to RGB(255,0,0)
2) Load and rectify a jpg using GM_LoadRectifiedLayer
3) Get RasterDisplayOptions of loaded layer
4) Set mTransparent to TRUE and mTransparentColor to RBG(255,0,0)
5) Set RasterDisplayOptions of loaded layer
6) Export layer using GM_ExportRaster in GEO_TIFF format
The geo-rectified image is exported but the red background of the image is also saved in the tiff file.
BTW, i'm using SDK 1.26. Hesistant to upgrade to the later version due to change in interface of the old and new SDK.
I am now currently doing it in this manner:
1) Set Background Color to RGB(255,0,0)
2) Load and rectify a jpg using GM_LoadRectifiedLayer
3) Get RasterDisplayOptions of loaded layer
4) Set mTransparent to TRUE and mTransparentColor to RBG(255,0,0)
5) Set RasterDisplayOptions of loaded layer
6) Export layer using GM_ExportRaster in GEO_TIFF format
The geo-rectified image is exported but the red background of the image is also saved in the tiff file.
BTW, i'm using SDK 1.26. Hesistant to upgrade to the later version due to change in interface of the old and new SDK.
Comments
-
You can do a transparent export, but you would need to upgrade your SDK to get support. Note that the SDK is almost 100% backwards-compatible, so typically no code updates are needed. You may need to change your installer package for the latest SDK though as it now requires a different set of DLLs. Your code should be the same though.
In the newer SDKs, if you pass in the GM_ExportFlags_AddAlpha flag to your GM_ExportRaster call that is creating a 24-bit RGB GeoTIFF you should get an alpha channel added that marks the background areas as transparent.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
I beg to differ
I realized that the AddXXXToCustomVectorLayer is gone and is replaced by AddXXXToVectorLayer (not really a big issue, just a find and replace) but is not sure if there's any other issues
also, I'm still using .NET 2003, trying to get 131 to work with my existing system now.
But I guess I've no choice but to upgrade to the new version to use the AddAlpha flag.
Also, I'm facing problem to run the sample app on sdk131.
I've copied all the dlls in the bin folder to the folder of the sample_app\Release and tried running the pre-compiled GMDLL_Tester.exe and encountered the following error:
This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
P.S in which version is the AddAlpha flag added? If it's prior to the VS2008 version, I might still be able to use the non-latest version -
downloaded 1.29 and the export with transparency works.
downloaded the vcredist_x86 for visual studio 9.0 and the 1.31 works.
However, still need to evaluate whether the old codes will work with the new SDK (due to the additional of mRotation fields, etc etc). Not sure if these are properly handled in our codes.
Nevertheless, thanks for the prompt reply on the transparency issue
Cheers. -
If you can get v1.31 to work I would just use that.
So long as you are zeroing out your structures before use and using the mSize parameter in structures where it exists your code should work with almost no modification (barring examples like the GM_Add*ToVectorLayer that just had a rename).
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com
Categories
- 12.9K All Categories
- 5.7K Features Discussion
- 346 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 645 GM Script Language
- 54 User Scripts
- 115 GPS Features
- 419 Projection Questions
- 829 Raster Data
- 1.4K Vector Data
- 6.6K Support
- 180 Announcement and News
- 926 Bug Report
- 561 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 575 Other Discussion
- 132 GIS Data Sources
- 27 Global Mapper Showcase
- 242 How I use Global Mapper
- 108 Global Mapper Forum Website