Exporting Transparent Geo-Tiff?

seet
seet Global Mapper User
edited August 2009 in SDK
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.

Comments

  • global_mapper
    global_mapper Administrator
    edited August 2009
    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
  • seet
    seet Global Mapper User
    edited August 2009
    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 :)
  • seet
    seet Global Mapper User
    edited August 2009
    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.
  • global_mapper
    global_mapper Administrator
    edited August 2009
    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