how to extract 'copyright status' from JPEG in C#












3















I created an app which reads the JPEG meta data and stores it in the database, so that we can see if it has rogue characters. I can extract the meta data using below code but i am unable to extract copyright Status. Is there a way i can extract that?



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")
);
}


Is it possible to get "Copyright status" from code? this is in Photoshop and we can view it in Photoshop.



Copyright status










share|improve this question

























  • How is that different from the Copyright property?

    – Peter Ritchie
    Aug 19 '14 at 15:40











  • Copyright will have the ©Company but status has 3 values 'Unknown', 'Copyrighted' and 'public domain' controlledvocabulary.com/imagedatabases/…

    – Kamran Pervaiz
    Aug 19 '14 at 15:48






  • 1





    This link suggests perhaps: metadata.GetQuery("/xmp/xmpRights:Marked"); (From some googling, false = public domain, true = copyrighted, null = unknown)

    – Bridge
    Aug 19 '14 at 16:11













  • thanks its giving only true or false which i think is incorrect. I think I need to compare 3 images where copyright status is different.

    – Kamran Pervaiz
    Aug 19 '14 at 16:15











  • I think you'll have to manually read the EXIF data to get at that. In which case, see stackoverflow.com/questions/58649/…

    – Peter Ritchie
    Aug 19 '14 at 16:40
















3















I created an app which reads the JPEG meta data and stores it in the database, so that we can see if it has rogue characters. I can extract the meta data using below code but i am unable to extract copyright Status. Is there a way i can extract that?



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")
);
}


Is it possible to get "Copyright status" from code? this is in Photoshop and we can view it in Photoshop.



Copyright status










share|improve this question

























  • How is that different from the Copyright property?

    – Peter Ritchie
    Aug 19 '14 at 15:40











  • Copyright will have the ©Company but status has 3 values 'Unknown', 'Copyrighted' and 'public domain' controlledvocabulary.com/imagedatabases/…

    – Kamran Pervaiz
    Aug 19 '14 at 15:48






  • 1





    This link suggests perhaps: metadata.GetQuery("/xmp/xmpRights:Marked"); (From some googling, false = public domain, true = copyrighted, null = unknown)

    – Bridge
    Aug 19 '14 at 16:11













  • thanks its giving only true or false which i think is incorrect. I think I need to compare 3 images where copyright status is different.

    – Kamran Pervaiz
    Aug 19 '14 at 16:15











  • I think you'll have to manually read the EXIF data to get at that. In which case, see stackoverflow.com/questions/58649/…

    – Peter Ritchie
    Aug 19 '14 at 16:40














3












3








3








I created an app which reads the JPEG meta data and stores it in the database, so that we can see if it has rogue characters. I can extract the meta data using below code but i am unable to extract copyright Status. Is there a way i can extract that?



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")
);
}


Is it possible to get "Copyright status" from code? this is in Photoshop and we can view it in Photoshop.



Copyright status










share|improve this question
















I created an app which reads the JPEG meta data and stores it in the database, so that we can see if it has rogue characters. I can extract the meta data using below code but i am unable to extract copyright Status. Is there a way i can extract that?



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")
);
}


Is it possible to get "Copyright status" from code? this is in Photoshop and we can view it in Photoshop.



Copyright status







c# metadata jpeg photoshop xmp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 19 '14 at 16:02









Daniel A. White

150k37296375




150k37296375










asked Aug 19 '14 at 15:38









Kamran PervaizKamran Pervaiz

1,10721132




1,10721132













  • How is that different from the Copyright property?

    – Peter Ritchie
    Aug 19 '14 at 15:40











  • Copyright will have the ©Company but status has 3 values 'Unknown', 'Copyrighted' and 'public domain' controlledvocabulary.com/imagedatabases/…

    – Kamran Pervaiz
    Aug 19 '14 at 15:48






  • 1





    This link suggests perhaps: metadata.GetQuery("/xmp/xmpRights:Marked"); (From some googling, false = public domain, true = copyrighted, null = unknown)

    – Bridge
    Aug 19 '14 at 16:11













  • thanks its giving only true or false which i think is incorrect. I think I need to compare 3 images where copyright status is different.

    – Kamran Pervaiz
    Aug 19 '14 at 16:15











  • I think you'll have to manually read the EXIF data to get at that. In which case, see stackoverflow.com/questions/58649/…

    – Peter Ritchie
    Aug 19 '14 at 16:40



















  • How is that different from the Copyright property?

    – Peter Ritchie
    Aug 19 '14 at 15:40











  • Copyright will have the ©Company but status has 3 values 'Unknown', 'Copyrighted' and 'public domain' controlledvocabulary.com/imagedatabases/…

    – Kamran Pervaiz
    Aug 19 '14 at 15:48






  • 1





    This link suggests perhaps: metadata.GetQuery("/xmp/xmpRights:Marked"); (From some googling, false = public domain, true = copyrighted, null = unknown)

    – Bridge
    Aug 19 '14 at 16:11













  • thanks its giving only true or false which i think is incorrect. I think I need to compare 3 images where copyright status is different.

    – Kamran Pervaiz
    Aug 19 '14 at 16:15











  • I think you'll have to manually read the EXIF data to get at that. In which case, see stackoverflow.com/questions/58649/…

    – Peter Ritchie
    Aug 19 '14 at 16:40

















How is that different from the Copyright property?

– Peter Ritchie
Aug 19 '14 at 15:40





How is that different from the Copyright property?

– Peter Ritchie
Aug 19 '14 at 15:40













Copyright will have the ©Company but status has 3 values 'Unknown', 'Copyrighted' and 'public domain' controlledvocabulary.com/imagedatabases/…

– Kamran Pervaiz
Aug 19 '14 at 15:48





Copyright will have the ©Company but status has 3 values 'Unknown', 'Copyrighted' and 'public domain' controlledvocabulary.com/imagedatabases/…

– Kamran Pervaiz
Aug 19 '14 at 15:48




1




1





This link suggests perhaps: metadata.GetQuery("/xmp/xmpRights:Marked"); (From some googling, false = public domain, true = copyrighted, null = unknown)

– Bridge
Aug 19 '14 at 16:11







This link suggests perhaps: metadata.GetQuery("/xmp/xmpRights:Marked"); (From some googling, false = public domain, true = copyrighted, null = unknown)

– Bridge
Aug 19 '14 at 16:11















thanks its giving only true or false which i think is incorrect. I think I need to compare 3 images where copyright status is different.

– Kamran Pervaiz
Aug 19 '14 at 16:15





thanks its giving only true or false which i think is incorrect. I think I need to compare 3 images where copyright status is different.

– Kamran Pervaiz
Aug 19 '14 at 16:15













I think you'll have to manually read the EXIF data to get at that. In which case, see stackoverflow.com/questions/58649/…

– Peter Ritchie
Aug 19 '14 at 16:40





I think you'll have to manually read the EXIF data to get at that. In which case, see stackoverflow.com/questions/58649/…

– Peter Ritchie
Aug 19 '14 at 16:40












3 Answers
3






active

oldest

votes


















1














There is no copyright field defined by JPEG. The Exif file format supports a copyright. Maybe others as well.



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






share|improve this answer
























  • thanks and I have tried many tools to extract Exif data but could not extract copy right status, I think its a Photoshop proprietary property?

    – Kamran Pervaiz
    Aug 20 '14 at 8:48











  • There is an Adobe JPEG file format as well. THere are Adobe extension blocks. You could put some copyright text in and see where Photoshop puts it. What marker?

    – user3344003
    Aug 20 '14 at 14:08



















1














I have found the way, as Bridge suggested that Marked is the key. I asked business users for 3 images and below are my findings



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





share|improve this answer



















  • 1





    Glad I could help - may as well mark this as the answer :)

    – Bridge
    Aug 21 '14 at 10:27





















0














I had no problem getting the copyright field from a jpeg using nothing but a reference to Shell32.dll with this code that I found:



    private void ListData()
{
List<string> arrHeaders = new List<string>();
List<Tuple<int, string, string>> attributes = new List<Tuple<int, string, string>>();

Shell32.Shell shell = new Shell32.Shell();
var strFileName = filepath;
Shell32.Folder objFolder = shell.NameSpace(System.IO.Path.GetDirectoryName(strFileName));
Shell32.FolderItem folderItem = objFolder.ParseName(System.IO.Path.GetFileName(strFileName));


for (int i = 0; i < short.MaxValue; i++)
{
string header = objFolder.GetDetailsOf(null, i);
if (String.IsNullOrEmpty(header))
break;
arrHeaders.Add(header);
}

// The attributes list below will contain a tuple with attribute index, name and value
// Once you know the index of the attribute you want to get,
// you can get it directly without looping, like this:
var Authors = objFolder.GetDetailsOf(folderItem, 20);

for (int i = 0; i < arrHeaders.Count; i++)
{
var attrName = arrHeaders[i];
var attrValue = objFolder.GetDetailsOf(folderItem, i);
var attrIdx = i;

attributes.Add(new Tuple<int, string, string>(attrIdx, attrName, attrValue));

data.Add(string.Format("'{0}'='{1}'", attrName, attrValue));
}
Console.ReadLine();
}


Found it here and altered it slightly:
How to read extended file properties / file metadata






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f25387542%2fhow-to-extract-copyright-status-from-jpeg-in-c-sharp%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    There is no copyright field defined by JPEG. The Exif file format supports a copyright. Maybe others as well.



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






    share|improve this answer
























    • thanks and I have tried many tools to extract Exif data but could not extract copy right status, I think its a Photoshop proprietary property?

      – Kamran Pervaiz
      Aug 20 '14 at 8:48











    • There is an Adobe JPEG file format as well. THere are Adobe extension blocks. You could put some copyright text in and see where Photoshop puts it. What marker?

      – user3344003
      Aug 20 '14 at 14:08
















    1














    There is no copyright field defined by JPEG. The Exif file format supports a copyright. Maybe others as well.



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






    share|improve this answer
























    • thanks and I have tried many tools to extract Exif data but could not extract copy right status, I think its a Photoshop proprietary property?

      – Kamran Pervaiz
      Aug 20 '14 at 8:48











    • There is an Adobe JPEG file format as well. THere are Adobe extension blocks. You could put some copyright text in and see where Photoshop puts it. What marker?

      – user3344003
      Aug 20 '14 at 14:08














    1












    1








    1







    There is no copyright field defined by JPEG. The Exif file format supports a copyright. Maybe others as well.



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






    share|improve this answer













    There is no copyright field defined by JPEG. The Exif file format supports a copyright. Maybe others as well.



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







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Aug 20 '14 at 2:52









    user3344003user3344003

    14.7k31538




    14.7k31538













    • thanks and I have tried many tools to extract Exif data but could not extract copy right status, I think its a Photoshop proprietary property?

      – Kamran Pervaiz
      Aug 20 '14 at 8:48











    • There is an Adobe JPEG file format as well. THere are Adobe extension blocks. You could put some copyright text in and see where Photoshop puts it. What marker?

      – user3344003
      Aug 20 '14 at 14:08



















    • thanks and I have tried many tools to extract Exif data but could not extract copy right status, I think its a Photoshop proprietary property?

      – Kamran Pervaiz
      Aug 20 '14 at 8:48











    • There is an Adobe JPEG file format as well. THere are Adobe extension blocks. You could put some copyright text in and see where Photoshop puts it. What marker?

      – user3344003
      Aug 20 '14 at 14:08

















    thanks and I have tried many tools to extract Exif data but could not extract copy right status, I think its a Photoshop proprietary property?

    – Kamran Pervaiz
    Aug 20 '14 at 8:48





    thanks and I have tried many tools to extract Exif data but could not extract copy right status, I think its a Photoshop proprietary property?

    – Kamran Pervaiz
    Aug 20 '14 at 8:48













    There is an Adobe JPEG file format as well. THere are Adobe extension blocks. You could put some copyright text in and see where Photoshop puts it. What marker?

    – user3344003
    Aug 20 '14 at 14:08





    There is an Adobe JPEG file format as well. THere are Adobe extension blocks. You could put some copyright text in and see where Photoshop puts it. What marker?

    – user3344003
    Aug 20 '14 at 14:08













    1














    I have found the way, as Bridge suggested that Marked is the key. I asked business users for 3 images and below are my findings



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





    share|improve this answer



















    • 1





      Glad I could help - may as well mark this as the answer :)

      – Bridge
      Aug 21 '14 at 10:27


















    1














    I have found the way, as Bridge suggested that Marked is the key. I asked business users for 3 images and below are my findings



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





    share|improve this answer



















    • 1





      Glad I could help - may as well mark this as the answer :)

      – Bridge
      Aug 21 '14 at 10:27
















    1












    1








    1







    I have found the way, as Bridge suggested that Marked is the key. I asked business users for 3 images and below are my findings



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





    share|improve this answer













    I have found the way, as Bridge suggested that Marked is the key. I asked business users for 3 images and below are my findings



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






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Aug 21 '14 at 9:37









    Kamran PervaizKamran Pervaiz

    1,10721132




    1,10721132








    • 1





      Glad I could help - may as well mark this as the answer :)

      – Bridge
      Aug 21 '14 at 10:27
















    • 1





      Glad I could help - may as well mark this as the answer :)

      – Bridge
      Aug 21 '14 at 10:27










    1




    1





    Glad I could help - may as well mark this as the answer :)

    – Bridge
    Aug 21 '14 at 10:27







    Glad I could help - may as well mark this as the answer :)

    – Bridge
    Aug 21 '14 at 10:27













    0














    I had no problem getting the copyright field from a jpeg using nothing but a reference to Shell32.dll with this code that I found:



        private void ListData()
    {
    List<string> arrHeaders = new List<string>();
    List<Tuple<int, string, string>> attributes = new List<Tuple<int, string, string>>();

    Shell32.Shell shell = new Shell32.Shell();
    var strFileName = filepath;
    Shell32.Folder objFolder = shell.NameSpace(System.IO.Path.GetDirectoryName(strFileName));
    Shell32.FolderItem folderItem = objFolder.ParseName(System.IO.Path.GetFileName(strFileName));


    for (int i = 0; i < short.MaxValue; i++)
    {
    string header = objFolder.GetDetailsOf(null, i);
    if (String.IsNullOrEmpty(header))
    break;
    arrHeaders.Add(header);
    }

    // The attributes list below will contain a tuple with attribute index, name and value
    // Once you know the index of the attribute you want to get,
    // you can get it directly without looping, like this:
    var Authors = objFolder.GetDetailsOf(folderItem, 20);

    for (int i = 0; i < arrHeaders.Count; i++)
    {
    var attrName = arrHeaders[i];
    var attrValue = objFolder.GetDetailsOf(folderItem, i);
    var attrIdx = i;

    attributes.Add(new Tuple<int, string, string>(attrIdx, attrName, attrValue));

    data.Add(string.Format("'{0}'='{1}'", attrName, attrValue));
    }
    Console.ReadLine();
    }


    Found it here and altered it slightly:
    How to read extended file properties / file metadata






    share|improve this answer




























      0














      I had no problem getting the copyright field from a jpeg using nothing but a reference to Shell32.dll with this code that I found:



          private void ListData()
      {
      List<string> arrHeaders = new List<string>();
      List<Tuple<int, string, string>> attributes = new List<Tuple<int, string, string>>();

      Shell32.Shell shell = new Shell32.Shell();
      var strFileName = filepath;
      Shell32.Folder objFolder = shell.NameSpace(System.IO.Path.GetDirectoryName(strFileName));
      Shell32.FolderItem folderItem = objFolder.ParseName(System.IO.Path.GetFileName(strFileName));


      for (int i = 0; i < short.MaxValue; i++)
      {
      string header = objFolder.GetDetailsOf(null, i);
      if (String.IsNullOrEmpty(header))
      break;
      arrHeaders.Add(header);
      }

      // The attributes list below will contain a tuple with attribute index, name and value
      // Once you know the index of the attribute you want to get,
      // you can get it directly without looping, like this:
      var Authors = objFolder.GetDetailsOf(folderItem, 20);

      for (int i = 0; i < arrHeaders.Count; i++)
      {
      var attrName = arrHeaders[i];
      var attrValue = objFolder.GetDetailsOf(folderItem, i);
      var attrIdx = i;

      attributes.Add(new Tuple<int, string, string>(attrIdx, attrName, attrValue));

      data.Add(string.Format("'{0}'='{1}'", attrName, attrValue));
      }
      Console.ReadLine();
      }


      Found it here and altered it slightly:
      How to read extended file properties / file metadata






      share|improve this answer


























        0












        0








        0







        I had no problem getting the copyright field from a jpeg using nothing but a reference to Shell32.dll with this code that I found:



            private void ListData()
        {
        List<string> arrHeaders = new List<string>();
        List<Tuple<int, string, string>> attributes = new List<Tuple<int, string, string>>();

        Shell32.Shell shell = new Shell32.Shell();
        var strFileName = filepath;
        Shell32.Folder objFolder = shell.NameSpace(System.IO.Path.GetDirectoryName(strFileName));
        Shell32.FolderItem folderItem = objFolder.ParseName(System.IO.Path.GetFileName(strFileName));


        for (int i = 0; i < short.MaxValue; i++)
        {
        string header = objFolder.GetDetailsOf(null, i);
        if (String.IsNullOrEmpty(header))
        break;
        arrHeaders.Add(header);
        }

        // The attributes list below will contain a tuple with attribute index, name and value
        // Once you know the index of the attribute you want to get,
        // you can get it directly without looping, like this:
        var Authors = objFolder.GetDetailsOf(folderItem, 20);

        for (int i = 0; i < arrHeaders.Count; i++)
        {
        var attrName = arrHeaders[i];
        var attrValue = objFolder.GetDetailsOf(folderItem, i);
        var attrIdx = i;

        attributes.Add(new Tuple<int, string, string>(attrIdx, attrName, attrValue));

        data.Add(string.Format("'{0}'='{1}'", attrName, attrValue));
        }
        Console.ReadLine();
        }


        Found it here and altered it slightly:
        How to read extended file properties / file metadata






        share|improve this answer













        I had no problem getting the copyright field from a jpeg using nothing but a reference to Shell32.dll with this code that I found:



            private void ListData()
        {
        List<string> arrHeaders = new List<string>();
        List<Tuple<int, string, string>> attributes = new List<Tuple<int, string, string>>();

        Shell32.Shell shell = new Shell32.Shell();
        var strFileName = filepath;
        Shell32.Folder objFolder = shell.NameSpace(System.IO.Path.GetDirectoryName(strFileName));
        Shell32.FolderItem folderItem = objFolder.ParseName(System.IO.Path.GetFileName(strFileName));


        for (int i = 0; i < short.MaxValue; i++)
        {
        string header = objFolder.GetDetailsOf(null, i);
        if (String.IsNullOrEmpty(header))
        break;
        arrHeaders.Add(header);
        }

        // The attributes list below will contain a tuple with attribute index, name and value
        // Once you know the index of the attribute you want to get,
        // you can get it directly without looping, like this:
        var Authors = objFolder.GetDetailsOf(folderItem, 20);

        for (int i = 0; i < arrHeaders.Count; i++)
        {
        var attrName = arrHeaders[i];
        var attrValue = objFolder.GetDetailsOf(folderItem, i);
        var attrIdx = i;

        attributes.Add(new Tuple<int, string, string>(attrIdx, attrName, attrValue));

        data.Add(string.Format("'{0}'='{1}'", attrName, attrValue));
        }
        Console.ReadLine();
        }


        Found it here and altered it slightly:
        How to read extended file properties / file metadata







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 24 '18 at 16:04









        ThomasThomas

        383




        383






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f25387542%2fhow-to-extract-copyright-status-from-jpeg-in-c-sharp%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Wiesbaden

            Marschland

            Dieringhausen