Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/image/jpeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class JPEG {
this.width = this.data.readUInt16BE(pos);
pos += 2;

const channels = this.data[pos + 1];
const channels = this.data[pos];
this.colorSpace = COLOR_SPACE_MAP[channels];

this.obj = null;
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/image.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ describe('Image', function () {
expect(jpeg.orientation).toBe(1);
});

test('RGB JPEG is parsed with DeviceRGB color space (regression)', () => {
const data = fs.readFileSync('./tests/images/bee.jpg');
const jpeg = new JPEG(data, 'test');
expect(jpeg.colorSpace).toBe('DeviceRGB');
});

describe('opacity', function () {
test('adds an ExtGState with the correct ca value', () => {
document.image('./tests/images/bee.png', 0, 0, { opacity: 0.5 });
Expand Down
Loading