mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Ensure withMetadata adds default sRGB profile #3761
This commit is contained in:
parent
a2cac61209
commit
bb7469b2d1
@ -21,6 +21,9 @@ Requires libvips v8.14.3
|
|||||||
[#3758](https://github.com/lovell/sharp/pull/3758)
|
[#3758](https://github.com/lovell/sharp/pull/3758)
|
||||||
[@sho-xizz](https://github.com/sho-xizz)
|
[@sho-xizz](https://github.com/sho-xizz)
|
||||||
|
|
||||||
|
* Ensure `withMetadata` adds default sRGB profile.
|
||||||
|
[#3761](https://github.com/lovell/sharp/issues/3761)
|
||||||
|
|
||||||
### v0.32.4 - 21st July 2023
|
### v0.32.4 - 21st July 2023
|
||||||
|
|
||||||
* Upgrade to libvips v8.14.3 for upstream bug fixes.
|
* Upgrade to libvips v8.14.3 for upstream bug fixes.
|
||||||
|
@ -788,9 +788,9 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply output ICC profile
|
// Apply output ICC profile
|
||||||
if (!baton->withMetadataIcc.empty()) {
|
if (baton->withMetadata) {
|
||||||
image = image.icc_transform(
|
image = image.icc_transform(
|
||||||
const_cast<char*>(baton->withMetadataIcc.data()),
|
baton->withMetadataIcc.empty() ? "srgb" : const_cast<char*>(baton->withMetadataIcc.data()),
|
||||||
VImage::option()
|
VImage::option()
|
||||||
->set("input_profile", processingProfile)
|
->set("input_profile", processingProfile)
|
||||||
->set("embedded", TRUE)
|
->set("embedded", TRUE)
|
||||||
|
@ -781,6 +781,19 @@ describe('Image metadata', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('withMetadata adds default sRGB profile', async () => {
|
||||||
|
const data = await sharp(fixtures.inputJpg)
|
||||||
|
.resize(32, 24)
|
||||||
|
.withMetadata()
|
||||||
|
.toBuffer();
|
||||||
|
|
||||||
|
const metadata = await sharp(data).metadata();
|
||||||
|
const { colorSpace, deviceClass, intent } = icc.parse(metadata.icc);
|
||||||
|
assert.strictEqual(colorSpace, 'RGB');
|
||||||
|
assert.strictEqual(deviceClass, 'Monitor');
|
||||||
|
assert.strictEqual(intent, 'Perceptual');
|
||||||
|
});
|
||||||
|
|
||||||
it('File input with corrupt header fails gracefully', function (done) {
|
it('File input with corrupt header fails gracefully', function (done) {
|
||||||
sharp(fixtures.inputJpgWithCorruptHeader)
|
sharp(fixtures.inputJpgWithCorruptHeader)
|
||||||
.metadata(function (err) {
|
.metadata(function (err) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user