mirror of
https://github.com/webmproject/libwebp.git
synced 2025-03-09 19:22:49 +01:00
Merge changes I1437390a,I10a20de5,I1ac777d1 into main
* changes: pngdec.c: add support for 'eXIf' tag pngdec.c: support ImageMagick app1 exif text data pngdec.c: add missing #ifdef for png_get_iCCP
This commit is contained in:
commit
1d86819f49
@ -139,6 +139,8 @@ static const struct {
|
|||||||
{ "Raw profile type xmp", ProcessRawProfile, METADATA_OFFSET(xmp) },
|
{ "Raw profile type xmp", ProcessRawProfile, METADATA_OFFSET(xmp) },
|
||||||
// Exiftool puts exif data in APP1 chunk, too.
|
// Exiftool puts exif data in APP1 chunk, too.
|
||||||
{ "Raw profile type APP1", ProcessRawProfile, METADATA_OFFSET(exif) },
|
{ "Raw profile type APP1", ProcessRawProfile, METADATA_OFFSET(exif) },
|
||||||
|
// ImageMagick uses lowercase app1.
|
||||||
|
{ "Raw profile type app1", ProcessRawProfile, METADATA_OFFSET(exif) },
|
||||||
// XMP Specification Part 3, Section 3 #PNG
|
// XMP Specification Part 3, Section 3 #PNG
|
||||||
{ "XML:com.adobe.xmp", MetadataCopy, METADATA_OFFSET(xmp) },
|
{ "XML:com.adobe.xmp", MetadataCopy, METADATA_OFFSET(xmp) },
|
||||||
{ NULL, NULL, 0 },
|
{ NULL, NULL, 0 },
|
||||||
@ -159,6 +161,20 @@ static int ExtractMetadataFromPNG(png_structp png,
|
|||||||
png_textp text = NULL;
|
png_textp text = NULL;
|
||||||
const png_uint_32 num = png_get_text(png, info, &text, NULL);
|
const png_uint_32 num = png_get_text(png, info, &text, NULL);
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
|
|
||||||
|
#ifdef PNG_eXIf_SUPPORTED
|
||||||
|
// Look for an 'eXIf' tag. Preference is given to this tag as it's newer
|
||||||
|
// than the TextualData tags.
|
||||||
|
{
|
||||||
|
png_bytep exif;
|
||||||
|
png_uint_32 len;
|
||||||
|
|
||||||
|
if (png_get_eXIf_1(png, info, &len, &exif) == PNG_INFO_eXIf) {
|
||||||
|
if (!MetadataCopy((const char*)exif, len, &metadata->exif)) return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // PNG_eXIf_SUPPORTED
|
||||||
|
|
||||||
// Look for EXIF / XMP metadata.
|
// Look for EXIF / XMP metadata.
|
||||||
for (i = 0; i < num; ++i, ++text) {
|
for (i = 0; i < num; ++i, ++text) {
|
||||||
int j;
|
int j;
|
||||||
@ -192,6 +208,7 @@ static int ExtractMetadataFromPNG(png_structp png,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef PNG_iCCP_SUPPORTED
|
||||||
// Look for an ICC profile.
|
// Look for an ICC profile.
|
||||||
{
|
{
|
||||||
png_charp name;
|
png_charp name;
|
||||||
@ -208,6 +225,7 @@ static int ExtractMetadataFromPNG(png_structp png,
|
|||||||
if (!MetadataCopy((const char*)profile, len, &metadata->iccp)) return 0;
|
if (!MetadataCopy((const char*)profile, len, &metadata->iccp)) return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // PNG_iCCP_SUPPORTED
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user