mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Expose IPTC and XMP metadata when available (#1079)
This commit is contained in:
committed by
Lovell Fuller
parent
8afcb16d8e
commit
c4df115948
@@ -58,6 +58,23 @@ describe('Image metadata', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('JPEG with IPTC/XMP', function (done) {
|
||||
sharp(fixtures.inputJpgWithIptcAndXmp).metadata(function (err, metadata) {
|
||||
if (err) throw err;
|
||||
// IPTC
|
||||
assert.strictEqual('object', typeof metadata.iptc);
|
||||
assert.strictEqual(true, metadata.iptc instanceof Buffer);
|
||||
assert.strictEqual(18250, metadata.iptc.byteLength);
|
||||
assert.strictEqual(metadata.iptc.indexOf(Buffer.from('Photoshop')), 0);
|
||||
// XMP
|
||||
assert.strictEqual('object', typeof metadata.xmp);
|
||||
assert.strictEqual(true, metadata.xmp instanceof Buffer);
|
||||
assert.strictEqual(12495, metadata.xmp.byteLength);
|
||||
assert.strictEqual(metadata.xmp.indexOf(Buffer.from('http://ns.adobe.com/xap/1.0')), 0);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('TIFF', function (done) {
|
||||
sharp(fixtures.inputTiff).metadata(function (err, metadata) {
|
||||
if (err) throw err;
|
||||
|
||||
Reference in New Issue
Block a user