1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 14:48:08 +02:00

Merge pull request #19677 from Snuffleupagus/issue-19676

For JPEG images with CMYK-data, ensure that the alpha-component is set correctly when WebAssembly is disabled (issue 19676)
This commit is contained in:
Jonas Jenwald 2025-03-17 20:17:00 +01:00 committed by GitHub
commit 2f1497c9c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View file

@ -15,6 +15,7 @@
import { assert, BaseException, warn } from "../shared/util.js";
import { ColorSpaceUtils } from "./colorspace_utils.js";
import { DeviceCmykCS } from "./colorspace.js";
import { grayToRGBA } from "../shared/image_utils.js";
import { readUint16 } from "./core_utils.js";
@ -1349,6 +1350,13 @@ class JpegImage {
_convertCmykToRgba(data) {
ColorSpaceUtils.cmyk.getRgbBuffer(data, 0, data.length / 4, data, 0, 8, 1);
if (ColorSpaceUtils.cmyk instanceof DeviceCmykCS) {
// The alpha-component isn't updated by `DeviceCmykCS`, doing it manually.
for (let i = 3, ii = data.length; i < ii; i += 4) {
data[i] = 255;
}
}
return data;
}

View file

@ -2960,6 +2960,15 @@
"rounds": 1,
"type": "eq"
},
{
"id": "cmykjpeg_nowasm",
"file": "pdfs/cmykjpeg.pdf",
"md5": "85d162b48ce98503a382d96f574f70a2",
"link": false,
"rounds": 1,
"type": "eq",
"useWasm": false
},
{
"id": "issue4402_reduced",
"file": "pdfs/issue4402_reduced.pdf",