4

I am creating a series of tif files at 1:10k scale over a vast area (760 tiles) using arcpy.mapping.ExportToTIFF and then stitch them together to create a single ecw. The output looks ok but when I try to turn on transparency I find that the background "white" is not pure white (255,255,255) but values that "look white" like "254,254,252" or "254, 251, 250)

Is there anyway of setting a tolerance in the export so that any value between say 250 and 255) get re-described as 255,255,255? or any no-data areas get 255,255,255?

Alternatively would putting a background color (like green screening) that's not on the mxd work better than keeping the background undefined?

I am posting this and also researching the above options and others as they come to me as this is urgent.

EDIT 1 When I try jpg2000 I get better results but some white's are not correct. I am running the following command to create the tif

arcpy.mapping.ExportToTIFF(mxd,r"tests\SF\100k\SF100k_" + str(ddp.pageRow.PageName) + ".tif",df,9306,9306*ar,1800,True)

The issue is with the generated tif's as the "white" changes between tiles so when I stitch them in Global Mapper the "white" is different on each file. Would a raster calculator operation be able to clean this up? or can I fix it in the generation of the tif (ideally)? I need to run a similar process on 16 other map series at a few different scales so we are looking at over 10,000 individual tif tiles in 16 groups so the latter is preferred. enter image description here

EDIT 2:

PNG image enter image description here

Same area TIF image enter image description here

Any idea on why they look so different when it's exactly the same data? It's interesting that the symbology for the PNG is based on the data view while the TIF is based on the layout view. The PNG is much closer to the intended symbology.

Can Geoserver deal with Transparency in a different way to ArcGIS where the above issues then become irrelevant.

Thanks all,

9
  • Can you post a sample TIFF file?
    – blah238
    Commented Oct 22, 2012 at 6:56
  • Tried PNG export as well but the quality is lower than the TIF and some symbology is missed. See updates in question.
    – GeorgeC
    Commented Oct 22, 2012 at 22:52
  • I noticed something similar, it was all due to ArcMap's poorly conceieved default raster stretching options. Turn it off in the symbology tab (uncheck Apply Gamma Stretch and set Stretch Type to None).
    – blah238
    Commented Oct 22, 2012 at 23:05
  • Oh, I just saw your pictures. That actually looks more like a reference scale issue. I haven't noticed that myself. Are you exporting from layout view or data view? Do you have a reference scale set?
    – blah238
    Commented Oct 22, 2012 at 23:32
  • I had already turned these off as otherwise it came up with other colors. The issue with the PNG is that we need the symbology that's better represented in the TIF
    – GeorgeC
    Commented Oct 22, 2012 at 23:32

1 Answer 1

4

This problem is two-part:

  • ECW is a lossy compressed format, meaning it cannot accurately represent individual pixels' original values but instead uses wavelet compression to approximate the colors of chunks of the image. Unfortunately this type of compression is not good at representing continuous areas of identical colors.
  • ECW version 3 does not support an alpha channel, which allows you to specify areas of transparency. ECW version 4 does support alpha channels, but ArcGIS's built-in ECW support is for the older version 3.

The two solutions I see are to either:

  • Switch to JPEG2000, which is similar to ECW but also supports lossless compression as well as alpha channels
  • Use another software package such as ERDAS to create the ECW with alpha channel, but use the ERDAS ECW plugin for ArcGIS to be able to correctly read the alpha channels in ArcGIS

See also: Remove Collar from ECW File (Orthophoto Mosaic)

Update:

While the TIFF format itself supports alpha channel transparency, neither the interactive nor the arcpy TIFF export functions support it.

However, you could use PNG instead (using arcpy.mapping.ExportToPNG(), which does support alpha channel transparency. Simply set the background color and the transparent color to the same value and you will get a PNG with alpha channel, which you should be able to then convert to JPEG2000 and (hopefully) retain the alpha channel.

4
  • Thanks. I tried jp2 as well and it's better but you still get some pixels with the wrong "white". Pls see the updated question.
    – GeorgeC
    Commented Oct 22, 2012 at 6:19
  • Try ExportToPNG instead, the TIFF export functions do not support alpha channels.
    – blah238
    Commented Oct 22, 2012 at 7:51
  • Also try using lossless JPEG2000 instead of lossy since you appear to be displaying simple vector graphics. It should should avoid the ringing artifact you are seeing and it might even compress better.
    – blah238
    Commented Oct 22, 2012 at 7:58
  • Both the geoTiff and geoPNG formats work but not consistantly. For some data one is better than the other. The related issue though is combining the data into a single png/tif as we are looking at 1:25k or 1:10k tiles (161/760 tiles) respectively over 65k sqkm.
    – GeorgeC
    Commented Oct 23, 2012 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.