Merge pull request #11967 from havocbcn/jpg-rgb
Do not transform jpeg RGB components
This commit is contained in:
commit
ad261a2da4
@ -991,8 +991,10 @@ var JpegImage = (function JpegImageClosure() {
|
|||||||
var components = [],
|
var components = [],
|
||||||
component;
|
component;
|
||||||
for (i = 0; i < selectorsCount; i++) {
|
for (i = 0; i < selectorsCount; i++) {
|
||||||
var componentIndex = frame.componentIds[data[offset++]];
|
const index = data[offset++];
|
||||||
|
var componentIndex = frame.componentIds[index];
|
||||||
component = frame.components[componentIndex];
|
component = frame.components[componentIndex];
|
||||||
|
component.index = index;
|
||||||
var tableSpec = data[offset++];
|
var tableSpec = data[offset++];
|
||||||
component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
|
component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
|
||||||
component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
|
component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
|
||||||
@ -1088,6 +1090,7 @@ var JpegImage = (function JpegImageClosure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.components.push({
|
this.components.push({
|
||||||
|
index: component.index,
|
||||||
output: buildComponentData(frame, component),
|
output: buildComponentData(frame, component),
|
||||||
scaleX: component.h / frame.maxH,
|
scaleX: component.h / frame.maxH,
|
||||||
scaleY: component.v / frame.maxV,
|
scaleY: component.v / frame.maxV,
|
||||||
@ -1183,6 +1186,14 @@ var JpegImage = (function JpegImageClosure() {
|
|||||||
// dictionary has a 'ColorTransform' entry, explicitly set to `0`,
|
// dictionary has a 'ColorTransform' entry, explicitly set to `0`,
|
||||||
// then the colours should *not* be transformed.
|
// then the colours should *not* be transformed.
|
||||||
return false;
|
return false;
|
||||||
|
} else if (
|
||||||
|
this.components[0].index === /* "R" = */ 0x52 &&
|
||||||
|
this.components[1].index === /* "G" = */ 0x47 &&
|
||||||
|
this.components[2].index === /* "B" = */ 0x42
|
||||||
|
) {
|
||||||
|
// If the three components are indexed as RGB in ASCII
|
||||||
|
// then the colours should *not* be transformed.
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -147,6 +147,7 @@
|
|||||||
!issue1055r.pdf
|
!issue1055r.pdf
|
||||||
!issue11713.pdf
|
!issue11713.pdf
|
||||||
!issue1293r.pdf
|
!issue1293r.pdf
|
||||||
|
!issue11931.pdf
|
||||||
!issue1655r.pdf
|
!issue1655r.pdf
|
||||||
!issue6541.pdf
|
!issue6541.pdf
|
||||||
!issue2948.pdf
|
!issue2948.pdf
|
||||||
|
BIN
test/pdfs/issue11931.pdf
Normal file
BIN
test/pdfs/issue11931.pdf
Normal file
Binary file not shown.
@ -4367,6 +4367,12 @@
|
|||||||
"type": "eq",
|
"type": "eq",
|
||||||
"forms": true
|
"forms": true
|
||||||
},
|
},
|
||||||
|
{ "id": "issue11931",
|
||||||
|
"file": "pdfs/issue11931.pdf",
|
||||||
|
"md5": "9ea233037992e1f10280420a49e72845",
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "annotation-button-widget-annotations",
|
{ "id": "annotation-button-widget-annotations",
|
||||||
"file": "pdfs/annotation-button-widget.pdf",
|
"file": "pdfs/annotation-button-widget.pdf",
|
||||||
"md5": "5cf23adfff84256d9cfe261bea96dade",
|
"md5": "5cf23adfff84256d9cfe261bea96dade",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user