Repository navigation
fix(deck.gl-geotiff): read alpha from the alpha band, not the band count - #732
Merged
Merged
Conversation
The default COG pipeline drew the fourth band of any 4-band RGB image as alpha, so NAIP's near-infrared band made water and shadows see-through. A gray+alpha image lost its alpha, because BlackIsZero or WhiteIsZero wrote the gray value over the alpha band in `color.g`. The pipeline now decides from the bands' color interpretation: an RGB image whose fourth band isn't alpha is drawn opaque with a new `Opaque` module, and a gray image's alpha band is moved into alpha first with a new `GrayAlpha` module. `colorInterp` now counts associated alpha as alpha, as GDAL does, and `ColorInterp` is exported from @developmentseed/geotiff. Co-Authored-By: Claude Opus 5.5 <[email protected]>
kylebarron
added a commit
to thatbudakguy/deck.gl-raster
that referenced
this pull request
Oct 22, 2026
Resolve import conflicts with developmentseed#716 and developmentseed#732: keep main's new imports alongside `toPixelInterleaved`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR was written by Claude (Claude Code), not by @kylebarron.
The default COG pipeline drew the fourth band of any 4-band RGB image as alpha. NAIP's fourth band is near-infrared (ExtraSamples 0, "unspecified"), so water and shadows, which reflect little near-infrared, were drawn see-through. A gray+alpha image lost its alpha instead: its two-channel texture samples the alpha band into
color.g, andBlackIsZeroorWhiteIsZerothen writes the gray value over it.The pipeline now decides from the bands' color interpretation (#317):
Opaquemodule.GrayAlphamodule, which moves that band into alpha before the gray-to-RGB module runs.Both modules are exported from
@developmentseed/deck.gl-raster/gpu-modules, next toBlackIsZeroand the other color modules.colorInterpnow counts associated (premultiplied) alpha as alpha, as GDAL does; it counted only unassociated alpha. Without this, the pipeline would have drawn associated-alpha images opaque. Their color is still not un-premultiplied, as before.ColorInterpis now exported from@developmentseed/geotiff, since the publiccolorInterpgetter returns it.Checked in Chrome with cog-basic, temporarily pointed at a 4-band NAIP COG and at a gray+alpha COG whose left half has alpha 0. Before, the NAIP reservoir showed the basemap's water through the image and the gray image's transparent half was drawn; after, the reservoir is opaque and that half is transparent. The 3-band NAIP COG already in cog-basic renders pixel-identical before and after.
Closes #187, closes #361
🤖 Written by Claude Code