Replies: 2 comments
-
@mradamcox 👋 you can't use ALPHA band with JPEG compression but only internal mask. I'm quite surprised that you were able to create an RGBA Jpeg compressed file 🤔 TBH, I'm not quite sure to follow everything here... |
Beta Was this translation helpful? Give feedback.
-
Haha, yes sorry for the information overload. I have been deep in this GDAL rabbit hole... I was kind of surprised I could make the file this way too, but with the right combination of warp / translate options it is possible. Everything seemed fine until I saw these edges. However, sounds like this alpha band + JPEG compression is a bit of a hack, and it may be better to stick with more standard outputs. |
Beta Was this translation helpful? Give feedback.
-
Hello!
I've been using TiTiler for a while on a project where I generate GeoTIFFs of historical maps and serve them to web apps. I've been experimenting with different compression methods for the files I make behind the scenes, and have come across a strange issue when I use JPEG compression.
In TiTiler, the edges of the warped image look like this:
While the same edge in QGIS looks like
I have tried
nearest
andaverage
resampling while creating the image with GDAL (and have tried all of the different resampling methods available in TiTiler for retrieving the tile) but the issue persists.The file has an alpha band for a mask, and no overviews at the moment: https://loc-insurancemaps.us-southeast-1.linodeobjects.com/misc/augusta_wis_1910_p2__d2grZe_00-JPEG.tif
gdalinfo output:
Other methods of creating the file don't result in these artifacts in TiTiler (or QGIS):
COG
driver in gdal.Translate with JPEG compression: https://loc-insurancemaps.us-southeast-1.linodeobjects.com/misc/augusta_wis_1910_p2__rf3eHN_00-COG.tifOne significant difference with the COG driver is that it doesn't create an alpha band, it (somehow) puts a mask into each of the RGB bands (there is no No Data value). Also the COG driver uses
YCbCr
, which is not possible with an alpha band. Perhaps this is the root of the artifact problem?As things stand, I have some later operations that expect an alpha band in this image, but perhaps I should rework those later steps, so I can just use the COG driver here. Either way, I'd appreciate any thoughts on these edge artifacts, and whether they can be avoided in this scenario.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions