mirror of https://github.com/GNOME/gimp.git
libgimpbase: issue #1561 update Exif.Photo.PixelX/YDimension
Some images have Exif.Photo.PixelXDimension and Exif.Photo.PixelYDimension metadata tags in addition to Exif.Image.ImageWidth and Exif.Image.ImageHeight (mainly tiff images). So far, we were not updating these optional tags, meaning they could get out-of-sync with the actual dimensions when resizing and then exporting the image. Since these tags are non essential, we will only update them if they are already present.
This commit is contained in:
parent
0532cf31b9
commit
52fb1e93f9
|
@ -1461,6 +1461,8 @@ gimp_metadata_set_from_xmp (GimpMetadata *metadata,
|
||||||
* @height: Height in pixels
|
* @height: Height in pixels
|
||||||
*
|
*
|
||||||
* Sets Exif.Image.ImageWidth and Exif.Image.ImageLength on @metadata.
|
* Sets Exif.Image.ImageWidth and Exif.Image.ImageLength on @metadata.
|
||||||
|
* If already present, also sets Exif.Photo.PixelXDimension and
|
||||||
|
* Exif.Photo.PixelYDimension.
|
||||||
*
|
*
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
*/
|
*/
|
||||||
|
@ -1476,10 +1478,24 @@ gimp_metadata_set_pixel_size (GimpMetadata *metadata,
|
||||||
g_snprintf (buffer, sizeof (buffer), "%d", width);
|
g_snprintf (buffer, sizeof (buffer), "%d", width);
|
||||||
gexiv2_metadata_try_set_tag_string (GEXIV2_METADATA (metadata),
|
gexiv2_metadata_try_set_tag_string (GEXIV2_METADATA (metadata),
|
||||||
"Exif.Image.ImageWidth", buffer, NULL);
|
"Exif.Image.ImageWidth", buffer, NULL);
|
||||||
|
if (gexiv2_metadata_try_has_tag (GEXIV2_METADATA (metadata),
|
||||||
|
"Exif.Photo.PixelXDimension", NULL))
|
||||||
|
{
|
||||||
|
gexiv2_metadata_try_set_tag_string (GEXIV2_METADATA (metadata),
|
||||||
|
"Exif.Photo.PixelXDimension",
|
||||||
|
buffer, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
g_snprintf (buffer, sizeof (buffer), "%d", height);
|
g_snprintf (buffer, sizeof (buffer), "%d", height);
|
||||||
gexiv2_metadata_try_set_tag_string (GEXIV2_METADATA (metadata),
|
gexiv2_metadata_try_set_tag_string (GEXIV2_METADATA (metadata),
|
||||||
"Exif.Image.ImageLength", buffer, NULL);
|
"Exif.Image.ImageLength", buffer, NULL);
|
||||||
|
if (gexiv2_metadata_try_has_tag (GEXIV2_METADATA (metadata),
|
||||||
|
"Exif.Photo.PixelYDimension", NULL))
|
||||||
|
{
|
||||||
|
gexiv2_metadata_try_set_tag_string (GEXIV2_METADATA (metadata),
|
||||||
|
"Exif.Photo.PixelYDimension",
|
||||||
|
buffer, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue