Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revert a2153f8 and handle unassociated alpha properly.

  • Loading branch information...
commit dc9da3d86102becb687929013c718e65ed98414b 1 parent a2153f8
@GPHemsley authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 tiff.js
View
11 tiff.js
@@ -619,9 +619,14 @@ TIFFParser.prototype = {
var opacity = 1.0;
if (numExtraSamples > 0) {
- // Opacity is always the 4th sample.
- // Clamp opacity to the range [0,1].
- opacity = pixelSamples[3] / 256;
+ for (var k = 0; k < numExtraSamples; k++) {
+ if (extraSamplesValues[k] === 1 || extraSamplesValues[k] === 2) {
+ // Clamp opacity to the range [0,1].
+ opacity = pixelSamples[3 + k] / 256;
+
+ break;
+ }
+ }
}
switch (photometricInterpretation) {
Please sign in to comment.
Something went wrong with that request. Please try again.