Merge pull request #6984 from Snuffleupagus/issue-6066
Update `JpegImage.getData` to support `forceRGBoutput` for images with `numComponents === 1` (issue 6066)
This commit is contained in:
commit
8cdb69634f
@ -1019,7 +1019,18 @@ var JpegImage = (function jpegImage() {
|
||||
// type of data: Uint8Array(width * height * numComponents)
|
||||
var data = this._getLinearizedBlockData(width, height);
|
||||
|
||||
if (this.numComponents === 3) {
|
||||
if (this.numComponents === 1 && forceRGBoutput) {
|
||||
var dataLength = data.length;
|
||||
var rgbData = new Uint8Array(dataLength * 3);
|
||||
var offset = 0;
|
||||
for (var i = 0; i < dataLength; i++) {
|
||||
var grayColor = data[i];
|
||||
rgbData[offset++] = grayColor;
|
||||
rgbData[offset++] = grayColor;
|
||||
rgbData[offset++] = grayColor;
|
||||
}
|
||||
return rgbData;
|
||||
} else if (this.numComponents === 3) {
|
||||
return this._convertYccToRgb(data);
|
||||
} else if (this.numComponents === 4) {
|
||||
if (this._isColorConversionNeeded()) {
|
||||
|
1
test/pdfs/issue6066.pdf.link
Normal file
1
test/pdfs/issue6066.pdf.link
Normal file
@ -0,0 +1 @@
|
||||
http://web.archive.org/web/20160213124006/http://www.leon.pl/userfiles/file/Zapytanie%20ofertowe%201-2014.pdf
|
@ -980,6 +980,15 @@
|
||||
"lastPage": 3,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "issue6066",
|
||||
"file": "pdfs/issue6066.pdf",
|
||||
"md5": "b26eb08fc5ab2518ba8fde603bdfc46b",
|
||||
"rounds": 1,
|
||||
"link": true,
|
||||
"firstPage": 2,
|
||||
"lastPage": 2,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "issue1905",
|
||||
"file": "pdfs/issue1905.pdf",
|
||||
"md5": "b1bbd72ca6522ae1502aa26320f81994",
|
||||
|
Loading…
x
Reference in New Issue
Block a user