Copy EXIF, IPTC and XMP metadata from one JPEGfile to another
Posted: 2018-08-14T22:29:14-07:00
I need to copy any existing EXIF, IPTC and XMP metadata from one JPEG file (sourceFile) to another (destinationFile) with a different size and a different image. I am using the code below, based on the posting https://stackoverflow.com/questions/343 ... adata?lq=1 which observes that when two images are composited, the metadata of the first one is retained.
However, sourceImage.Height does not change when destinationImage.Height has a larger value and the composited image does not have the destination Image in it. Metadata in the IPTC and XMP groups is also missing. What am I doing wrong?
Code: Select all
using (MagickImage sourceImage = new MagickImage(sourceFile))
{
using (MagickImage destImage = new MagickImage(destinationFile))
{
int iDestWidth = destImage.Width;
int iDestHeight = destImage.Height;
sourceImage.Resize(iDestWidth, iDestHeight);
sourceImage.Composite(destImage);
}
sourceImage.Write(destinationFile);
}