How to extract "copyright status" from a JPEG in C #

I have created an application that reads JPEG metadata and stores it in a database so we can see if it has a rogue. I can extract the metadata using the code below, but I cannot extract the copyright status. Is there a way I can learn from this?

var stream = new FileStream(file, FileMode.Open, FileAccess.Read);
                        var decoder = new JpegBitmapDecoder(stream, BitmapCreateOptions.None, BitmapCacheOption.None);
                        var metadata = decoder.Frames[0].Metadata as BitmapMetadata;
                        if (metadata != null)
                        {
                            dataGridView1.Rows.Add(file,
                                metadata.ApplicationName,
                                metadata.Author != null ? metadata.Author.Aggregate((old, val) => old ?? "" + "; " + val) : "",
                                metadata.CameraManufacturer,
                                metadata.CameraModel,
                                metadata.Comment,
                                metadata.Copyright,
                                metadata.DateTaken,
                                metadata.Format,
                                metadata.Keywords != null ? metadata.Keywords.Aggregate((old, val) => old ?? "" + "; " + val) : "",
                                metadata.Location,
                                metadata.Rating,
                                metadata.Subject,
                                metadata.Title,
                                metadata.GetQuery("/xmp/photoshop:Instructions"),
                                metadata.GetQuery("/xmp/xmpRights:UsageTerms/x-default"),
                                metadata.GetQuery("/xmp/photoshop:Credit")
                                );
                        }

      

Can I get the Copyright Status code from the code? it is in Photoshop and we can preview it in Photoshop.

Copyright status

+3


source to share


2 answers


I found a way as Bridge assumed Marked is the key. I asked business users for 3 images and below are my results.



metadata.GetQuery("/xmp/xmpRights:Marked")  = ""      //for unknown
metadata.GetQuery("/xmp/xmpRights:Marked")  = "false" //for public domain 
metadata.GetQuery("/xmp/xmpRights:Marked")  = "true"  //for copyrighted

      

+1


source


There is no copyright field defined by JPEG. The Exif file format supports copyright. Perhaps others.



If you want copyright information, you will need to determine if you have an Exif file. If so, you will need to look for the APP1 marker after the SOI marker, determine if it is an EXIF ​​header, then search the TIFF header embedded in the marker and find the tag to protect.

+1


source







All Articles