This project has moved. For the latest updates, please go here.

XMP bag

Dec 3, 2013 at 11:20 AM
Edited Dec 3, 2013 at 11:29 AM
Hello!

This code for get the metadata from image:
using (MagickImage image = new MagickImage(srcPath.jpg))
            {
                image.Write(dstPath.xmp); // xmp
            }
rise the exeption: Magick: no APP1 data is available `dstPath.xmp' @ error/meta.c/WriteMETAImage/2367

on the simple various images (jpg, tiff).

Is it bag?

Version: Magick.NET-6.8.7.502-Q16-x86-net20
Coordinator
Dec 3, 2013 at 12:50 PM
What kind of metadata are you trying to extract? There are various methods in MagickImage to read metadata:
using (MagickImage image = new MagickImage("srcPath.jpg"))
{
  image.Get8BimProfile();
  image.GetExifProfile();
  image.GetIptcProfile();
}
Can you post a sample image I can use for testing?
Dec 3, 2013 at 1:40 PM
Edited Dec 3, 2013 at 1:54 PM
Yes. I try get dimension, size, color space, width, height, credentials etc.

Image

It is necessary not just to read the metadata, but write a XMP file with them.
Coordinator
Dec 3, 2013 at 5:44 PM
Edited Dec 3, 2013 at 5:44 PM
Your image does not contain a xmp profile and that is why you receive the exception from ImageMagick.
Dec 4, 2013 at 10:26 AM
Edited Dec 4, 2013 at 10:38 AM
Thank you! Is it possible to distinguish the absence of xmp profile in the image and runtime error program?

In other words, the program should write the error message in the log at runtime error. And not write to the log, if no xmp profile.

Maybe this can be done by error code? That means the following entry: @ error/meta.c/WriteMETAImage/2367 ?
2367 or 2366 is this error code ?
Coordinator
Dec 4, 2013 at 1:21 PM
You can check if your image contains an xmp profile with the following code:
if (image.GetProfile("xmp") == null)
  // do something
The number behind the error message is a line number.