diff --git a/packages/deck.gl-geotiff/src/geotiff/render-pipeline.ts b/packages/deck.gl-geotiff/src/geotiff/render-pipeline.ts index abda1cb..35b0b6a 100644 --- a/packages/deck.gl-geotiff/src/geotiff/render-pipeline.ts +++ b/packages/deck.gl-geotiff/src/geotiff/render-pipeline.ts @@ -6,7 +6,6 @@ import { CreateTexture, cieLabToRGB, FilterNoDataVal, - YCbCrToRGB, } from "@developmentseed/deck.gl-raster/gpu-modules"; import type { GeoTIFF, Overview } from "@developmentseed/geotiff"; import type { Device, SamplerProps, Texture } from "@luma.gl/core"; @@ -212,9 +211,10 @@ function photometricInterpretationToRGB( module: CMYKToRGB, }; case Photometric.Ycbcr: - return { - module: YCbCrToRGB, - }; + // @developmentseed/geotiff currently uses canvas to parse JPEG-compressed + // YCbCr images, which means the YCbCr->RGB conversion is already done by + // the browser's image decoder + return null; case Photometric.Cielab: return { module: cieLabToRGB, diff --git a/packages/geotiff/src/codecs/canvas.ts b/packages/geotiff/src/codecs/canvas.ts index 2b2a856..69d1b9b 100644 --- a/packages/geotiff/src/codecs/canvas.ts +++ b/packages/geotiff/src/codecs/canvas.ts @@ -17,7 +17,8 @@ export async function decode( ctx.drawImage(imageBitmap, 0, 0); imageBitmap.close(); - const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); + const { width, height } = canvas; + const imageData = ctx.getImageData(0, 0, width, height); const rgba = imageData.data; const samplesPerPixel = metadata.samplesPerPixel; @@ -26,7 +27,7 @@ export async function decode( } if (samplesPerPixel === 3) { - const pixelCount = imageBitmap.width * imageBitmap.height; + const pixelCount = width * height; const rgb = new Uint8ClampedArray(pixelCount * 3); for (let i = 0, j = 0; i < rgb.length; i += 3, j += 4) { rgb[i] = rgba[j]!;