Open REASY opened 1 year ago
WebImageDecoder should take into consideration fileDirectory.SamplesPerPixel. If it is equal to 3 it must convert buffer from RGB to RGBA.
fileDirectory.SamplesPerPixel
buffer
The output of gdalinfo on attached webp_rgb.tif (webp.zip)
gdalinfo
webp_rgb.tif
Data axis to CRS axis mapping: 1,2 Origin = (-13044819.684176461771131,3859305.558118546847254) Pixel Size = (0.074645535434684,-0.074645535434684) Metadata: AREA_OR_POINT=Area Image Structure Metadata: COMPRESSION=WEBP INTERLEAVE=PIXEL LAYOUT=COG Corner Coordinates: Upper Left (-13044819.684, 3859305.558) (117d11' 0.99"W, 32d43'42.15"N) Lower Left (-13044819.684, 3859229.121) (117d11' 0.99"W, 32d43'40.07"N) Upper Right (-13044743.247, 3859305.558) (117d10'58.52"W, 32d43'42.15"N) Lower Right (-13044743.247, 3859229.121) (117d10'58.52"W, 32d43'40.07"N) Center (-13044781.466, 3859267.340) (117d10'59.76"W, 32d43'41.11"N) Band 1 Block=512x512 Type=Byte, ColorInterp=Red NoData Value=0 Overviews: 256x256, 128x128, 64x64, 32x32, 16x16, 8x8, 4x4 Band 2 Block=512x512 Type=Byte, ColorInterp=Green NoData Value=0 Overviews: 256x256, 128x128, 64x64, 32x32, 16x16, 8x8, 4x4 Band 3 Block=512x512 Type=Byte, ColorInterp=Blue NoData Value=0 Overviews: 256x256, 128x128, 64x64, 32x32, 16x16, 8x8, 4x4
When I try to render it (using cog-explorer running locally):
The output of gdalinfo on attached webp_rgba.tif (webp.zip)
webp_rgba.tif
Data axis to CRS axis mapping: 1,2 Origin = (-13044819.684176461771131,3859305.558118546847254) Pixel Size = (0.074645535434684,-0.074645535434684) Metadata: AREA_OR_POINT=Area Image Structure Metadata: COMPRESSION=WEBP INTERLEAVE=PIXEL LAYOUT=COG Corner Coordinates: Upper Left (-13044819.684, 3859305.558) (117d11' 0.99"W, 32d43'42.15"N) Lower Left (-13044819.684, 3859229.121) (117d11' 0.99"W, 32d43'40.07"N) Upper Right (-13044743.247, 3859305.558) (117d10'58.52"W, 32d43'42.15"N) Lower Right (-13044743.247, 3859229.121) (117d10'58.52"W, 32d43'40.07"N) Center (-13044781.466, 3859267.340) (117d10'59.76"W, 32d43'41.11"N) Band 1 Block=512x512 Type=Byte, ColorInterp=Red NoData Value=0 Overviews: 256x256, 128x128, 64x64, 32x32, 16x16, 8x8, 4x4 Band 2 Block=512x512 Type=Byte, ColorInterp=Green NoData Value=0 Overviews: 256x256, 128x128, 64x64, 32x32, 16x16, 8x8, 4x4 Band 3 Block=512x512 Type=Byte, ColorInterp=Blue NoData Value=0 Overviews: 256x256, 128x128, 64x64, 32x32, 16x16, 8x8, 4x4 Band 4 Block=512x512 Type=Byte, ColorInterp=Alpha NoData Value=0 Overviews: 256x256, 128x128, 64x64, 32x32, 16x16, 8x8, 4x4
When I try to render it (using cog-explorer running locally), it looks fine :
https://github.com/geotiffjs/geotiff.js/blob/f15d7709efd5e519dc2834386305218208cecd9c/src/compression/webimage.js#L35-L36
Attached two GeoTIFF files as an example webp.zip
WebImageDecoder should take into consideration
fileDirectory.SamplesPerPixel
. If it is equal to 3 it must convertbuffer
from RGB to RGBA.RGB example, file webp_rgb.tif
The output of
gdalinfo
on attachedwebp_rgb.tif
(webp.zip)When I try to render it (using cog-explorer running locally):![image](https://github.com/geotiffjs/geotiff.js/assets/5107562/6fd87143-fb19-4740-b377-fd14895e3a93)
RGBA example, file webp_rgba.tif
The output of
gdalinfo
on attachedwebp_rgba.tif
(webp.zip)When I try to render it (using cog-explorer running locally), it looks fine :![image](https://github.com/geotiffjs/geotiff.js/assets/5107562/69f9265a-e651-4b69-ad0f-6faa937d1a41)
https://github.com/geotiffjs/geotiff.js/blob/f15d7709efd5e519dc2834386305218208cecd9c/src/compression/webimage.js#L35-L36
Environment
Attached two GeoTIFF files as an example webp.zip