Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #14 from yurydelendik/master

Adds support for two components images
  • Loading branch information...
commit 65169596baeb76faf9305dd65e632cf4fd3eea9c 2 parents 03d7fb8 + 0652a4f
@notmasteryet authored
Showing with 16 additions and 1 deletion.
  1. +16 −1 jpg.js
View
17 jpg.js
@@ -791,6 +791,21 @@ var JpegImage = (function jpegImage() {
}
}
break;
+ case 2:
+ // PDF might compress two component data in custom colorspace
+ component1 = this.components[0];
+ component2 = this.components[1];
+ for (y = 0; y < height; y++) {
+ component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)];
+ component2Line = component1.lines[0 | (y * component2.scaleY * scaleY)];
+ for (x = 0; x < width; x++) {
+ Y = component1Line[0 | (x * component1.scaleX * scaleX)];
+ data[offset++] = Y;
+ Y = component2Line[0 | (x * component2.scaleX * scaleX)];
+ data[offset++] = Y;
+ }
+ }
+ break;
case 3:
// The default transform for three components is true
colorTransform = true;
@@ -935,4 +950,4 @@ var JpegImage = (function jpegImage() {
};
return constructor;
-})();
+})();
Please sign in to comment.
Something went wrong with that request. Please try again.