This project has moved and is read-only. For the latest updates, please go here.

XMP bag

Dec 3, 2013 at 12:20 PM
Edited Dec 3, 2013 at 12:29 PM

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-
Dec 3, 2013 at 1: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"))
Can you post a sample image I can use for testing?
Dec 3, 2013 at 2:40 PM
Edited Dec 3, 2013 at 2:54 PM
Yes. I try get dimension, size, color space, width, height, credentials etc.


It is necessary not just to read the metadata, but write a XMP file with them.
Dec 3, 2013 at 6:44 PM
Edited Dec 3, 2013 at 6:44 PM
Your image does not contain a xmp profile and that is why you receive the exception from ImageMagick.
Dec 4, 2013 at 11:26 AM
Edited Dec 4, 2013 at 11: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 ?
Dec 4, 2013 at 2: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.