BitmapMetadata

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roger

    BitmapMetadata

    Hi all

    I have managed read metadata from an image file using BitmapMetaData, and
    that works fine,

    but I am having trouble finding out how to write the information back to the
    Image

    can anyone help with this please

    Thanks in advance

    Roger

  • =?Utf-8?B?Sm95?=

    #2
    RE: BitmapMetadata

    Hi Roger,
    Let me know if the following link was of any help to you:



    regards,
    Joy

    "Roger" wrote:
    Hi all
    >
    I have managed read metadata from an image file using BitmapMetaData, and
    that works fine,
    >
    but I am having trouble finding out how to write the information back to the
    Image
    >
    can anyone help with this please
    >
    Thanks in advance
    >
    Roger
    >

    Comment

    • Munna

      #3
      Re: BitmapMetadata

      On May 26, 7:39 pm, "Roger" <ro...@barretti nteriors.co.ukw rote:
      Hi all
      >
      I have managed read metadata from an image file using BitmapMetaData, and
      that works fine,
      >
      but I am having trouble finding out how to write the information back to the
      Image
      >
      can anyone help with this please
      >
      Thanks in advance
      >
      Roger
      Hi

      check out this component
      may help you
      Web file access system for your Active Directory users and Windows file system. External access to internal folders. Web access to existsing SMB shares. Qucik WFH (work form home) solution.


      Best of luck

      Munna



      Comment

      • Roger

        #4
        Re: BitmapMetadata

        Thanks for the link.

        I have looked there and tried a few examples that i have found oround the
        net.

        It seems that its all a little sketchy, and i have yet to find any one who
        have got this to work.

        I have found a c# libray which i am looking into now but it seems that the
        EXIF standard and MS standard are different.

        If you change the tags in Vista they do not seem to match the EXIF format.

        I have spent the weekend looking into this and am able to read tags with no
        problem at all.

        Writing to the tags seems a whole different ball game.

        I will keep trying.

        Anymore suggestions would be welcome.

        If I find away to make this work i will post the soloution.

        Great New group by the way I will try and participate

        Thanks again for the suggestions

        Roger

        "Joy" <Joy@discussion s.microsoft.com wrote in message
        news:8A42F91A-C1ED-4594-9CC4-8D6985C73E02@mi crosoft.com...
        Hi Roger,
        Let me know if the following link was of any help to you:
        >

        >
        regards,
        Joy
        >
        "Roger" wrote:
        >
        >Hi all
        >>
        >I have managed read metadata from an image file using BitmapMetaData, and
        >that works fine,
        >>
        >but I am having trouble finding out how to write the information back to
        >the
        >Image
        >>
        >can anyone help with this please
        >>
        >Thanks in advance
        >>
        >Roger
        >>

        Comment

        • =?Utf-8?B?Sm95?=

          #5
          Re: BitmapMetadata

          Hi Roger,
          Can you post the code piece so that i will have more clarity on as to what
          are you trying to do and hence will be more accomplished to give my inputs
          for the same.

          regards,
          Joy

          "Roger" wrote:
          Thanks for the link.
          >
          I have looked there and tried a few examples that i have found oround the
          net.
          >
          It seems that its all a little sketchy, and i have yet to find any one who
          have got this to work.
          >
          I have found a c# libray which i am looking into now but it seems that the
          EXIF standard and MS standard are different.
          >
          If you change the tags in Vista they do not seem to match the EXIF format.
          >
          I have spent the weekend looking into this and am able to read tags with no
          problem at all.
          >
          Writing to the tags seems a whole different ball game.
          >
          I will keep trying.
          >
          Anymore suggestions would be welcome.
          >
          If I find away to make this work i will post the soloution.
          >
          Great New group by the way I will try and participate
          >
          Thanks again for the suggestions
          >
          Roger
          >
          "Joy" <Joy@discussion s.microsoft.com wrote in message
          news:8A42F91A-C1ED-4594-9CC4-8D6985C73E02@mi crosoft.com...
          Hi Roger,
          Let me know if the following link was of any help to you:



          regards,
          Joy

          "Roger" wrote:
          Hi all
          >
          I have managed read metadata from an image file using BitmapMetaData, and
          that works fine,
          >
          but I am having trouble finding out how to write the information back to
          the
          Image
          >
          can anyone help with this please
          >
          Thanks in advance
          >
          Roger
          >
          >

          Comment

          • Roger

            #6
            Re: BitmapMetadata

            Code I have used so far

            This is the class i have for reding the data which works fine
            <snip>
            using System.Windows. Media.Imaging;
            using System.IO;
            <snip>

            /// <summary>
            /// Returns Image MetaData Preformated in a table
            /// using System.Windows. Media.Imaging (ref)
            /// dot.net 3.5 standard
            ///
            /// </summary>

            public static string returnMetaData( string imgFile)
            {
            string MetaData = null;




            BitmapSource img = BitmapFrame.Cre ate(new Uri(imgFile));
            BitmapMetadata meta = (BitmapMetadata )img.Metadata;
            // MetaData
            MetaData += "Title: " + meta.Title + Environment.New Line;
            MetaData += "Subject: " + meta.Subject + Environment.New Line;
            MetaData += "Comment: " + meta.Comment + Environment.New Line;
            MetaData += "Date taken: " + meta.DateTaken +
            Environment.New Line;
            MetaData += "Authors: " + meta.Author + Environment.New Line;

            /* Image data */
            double mpixel = (img.PixelHeigh t * img.PixelWidth) /
            (double)1000000 ;
            MetaData +="Image Width: "+ img.PixelWidth + "px"+
            Environment.New Line;
            MetaData +="Image Height: "+ img.PixelHeight + "px"+
            Environment.New Line;
            MetaData +="Megapixels : " + mpixel + Environment.New Line;
            MetaData += "DPI: " + img.DpiX + img.DpiY +Environment.Ne wLine;

            // More Metadata
            MetaData += "Camera Maker: " + meta.CameraManu facturer +
            Environment.New Line;
            MetaData += "Camera Model: " + meta.CameraMode l +
            Environment.New Line;
            MetaData += "Edited in: " + meta.Applicatio nName +
            Environment.New Line;
            MetaData += "Copyright: " + meta.Copyright +
            Environment.New Line;

            // remove unsafe characters for ajax postback

            MetaData = MetaData.Replac e ("<","");
            MetaData = MetaData.Replac e (">","");
            return MetaData ;

            }



            This is the code i have been trying to write the data with out sucess

            imageFile = "c://users//roger//documents//test.jpg";
            bool done = true;
            Stream jpgStream = new System.IO.FileS tream(imageFile ,
            FileMode.Open, FileAccess.Read Write, FileShare.ReadW rite);
            JpegBitmapDecod er jpgDecoder = new JpegBitmapDecod er(jpgStream,
            BitmapCreateOpt ions.PreservePi xelFormat, BitmapCacheOpti on.Default);
            BitmapFrame jpgFrame = jpgDecoder.Fram es[0];
            InPlaceBitmapMe tadataWriter jpgInplace =
            jpgFrame.Create InPlaceBitmapMe tadataWriter();
            if (jpgInplace.Try Save() == true)
            {

            jpgInplace.SetQ uery("/Text/Title", "Have a nice day");
            }
            jpgStream.Close ();
            --------------------------------------------------------------------------------------------------------


            "Joy" <Joy@discussion s.microsoft.com wrote in message
            news:700B6A65-009D-4080-AB98-F51B85BC5CC7@mi crosoft.com...
            Hi Roger,
            Can you post the code piece so that i will have more clarity on as to what
            are you trying to do and hence will be more accomplished to give my inputs
            for the same.
            >
            regards,
            Joy
            >
            "Roger" wrote:
            >
            >Thanks for the link.
            >>
            >I have looked there and tried a few examples that i have found oround the
            >net.
            >>
            >It seems that its all a little sketchy, and i have yet to find any one
            >who
            >have got this to work.
            >>
            >I have found a c# libray which i am looking into now but it seems that
            >the
            >EXIF standard and MS standard are different.
            >>
            >If you change the tags in Vista they do not seem to match the EXIF
            >format.
            >>
            >I have spent the weekend looking into this and am able to read tags with
            >no
            >problem at all.
            >>
            >Writing to the tags seems a whole different ball game.
            >>
            >I will keep trying.
            >>
            >Anymore suggestions would be welcome.
            >>
            >If I find away to make this work i will post the soloution.
            >>
            >Great New group by the way I will try and participate
            >>
            >Thanks again for the suggestions
            >>
            >Roger
            >>
            >"Joy" <Joy@discussion s.microsoft.com wrote in message
            >news:8A42F91 A-C1ED-4594-9CC4-8D6985C73E02@mi crosoft.com...
            Hi Roger,
            Let me know if the following link was of any help to you:
            >

            >
            regards,
            Joy
            >
            "Roger" wrote:
            >
            >Hi all
            >>
            >I have managed read metadata from an image file using BitmapMetaData,
            >and
            >that works fine,
            >>
            >but I am having trouble finding out how to write the information back
            >to
            >the
            >Image
            >>
            >can anyone help with this please
            >>
            >Thanks in advance
            >>
            >Roger
            >>
            >>

            Comment

            • =?Utf-8?B?Sm95?=

              #7
              Re: BitmapMetadata

              Hi Roger,
              Please let me know which version of the .NET Framework have you been using
              and also visit the following Url and let me know if it makes some sense to
              you:



              Please also let me know what specific error/exception have you been getting?

              regards,
              Joy

              "Roger" wrote:
              Code I have used so far
              >
              This is the class i have for reding the data which works fine
              <snip>
              using System.Windows. Media.Imaging;
              using System.IO;
              <snip>
              >
              /// <summary>
              /// Returns Image MetaData Preformated in a table
              /// using System.Windows. Media.Imaging (ref)
              /// dot.net 3.5 standard
              ///
              /// </summary>
              >
              public static string returnMetaData( string imgFile)
              {
              string MetaData = null;
              >
              >
              >
              >
              BitmapSource img = BitmapFrame.Cre ate(new Uri(imgFile));
              BitmapMetadata meta = (BitmapMetadata )img.Metadata;
              // MetaData
              MetaData += "Title: " + meta.Title + Environment.New Line;
              MetaData += "Subject: " + meta.Subject + Environment.New Line;
              MetaData += "Comment: " + meta.Comment + Environment.New Line;
              MetaData += "Date taken: " + meta.DateTaken +
              Environment.New Line;
              MetaData += "Authors: " + meta.Author + Environment.New Line;
              >
              /* Image data */
              double mpixel = (img.PixelHeigh t * img.PixelWidth) /
              (double)1000000 ;
              MetaData +="Image Width: "+ img.PixelWidth + "px"+
              Environment.New Line;
              MetaData +="Image Height: "+ img.PixelHeight + "px"+
              Environment.New Line;
              MetaData +="Megapixels : " + mpixel + Environment.New Line;
              MetaData += "DPI: " + img.DpiX + img.DpiY +Environment.Ne wLine;
              >
              // More Metadata
              MetaData += "Camera Maker: " + meta.CameraManu facturer +
              Environment.New Line;
              MetaData += "Camera Model: " + meta.CameraMode l +
              Environment.New Line;
              MetaData += "Edited in: " + meta.Applicatio nName +
              Environment.New Line;
              MetaData += "Copyright: " + meta.Copyright +
              Environment.New Line;
              >
              // remove unsafe characters for ajax postback
              >
              MetaData = MetaData.Replac e ("<","");
              MetaData = MetaData.Replac e (">","");
              return MetaData ;
              >
              }
              >
              >
              >
              This is the code i have been trying to write the data with out sucess
              >
              imageFile = "c://users//roger//documents//test.jpg";
              bool done = true;
              Stream jpgStream = new System.IO.FileS tream(imageFile ,
              FileMode.Open, FileAccess.Read Write, FileShare.ReadW rite);
              JpegBitmapDecod er jpgDecoder = new JpegBitmapDecod er(jpgStream,
              BitmapCreateOpt ions.PreservePi xelFormat, BitmapCacheOpti on.Default);
              BitmapFrame jpgFrame = jpgDecoder.Fram es[0];
              InPlaceBitmapMe tadataWriter jpgInplace =
              jpgFrame.Create InPlaceBitmapMe tadataWriter();
              if (jpgInplace.Try Save() == true)
              {
              >
              jpgInplace.SetQ uery("/Text/Title", "Have a nice day");
              }
              jpgStream.Close ();
              --------------------------------------------------------------------------------------------------------
              >
              >
              "Joy" <Joy@discussion s.microsoft.com wrote in message
              news:700B6A65-009D-4080-AB98-F51B85BC5CC7@mi crosoft.com...
              Hi Roger,
              Can you post the code piece so that i will have more clarity on as to what
              are you trying to do and hence will be more accomplished to give my inputs
              for the same.

              regards,
              Joy

              "Roger" wrote:
              Thanks for the link.
              >
              I have looked there and tried a few examples that i have found oround the
              net.
              >
              It seems that its all a little sketchy, and i have yet to find any one
              who
              have got this to work.
              >
              I have found a c# libray which i am looking into now but it seems that
              the
              EXIF standard and MS standard are different.
              >
              If you change the tags in Vista they do not seem to match the EXIF
              format.
              >
              I have spent the weekend looking into this and am able to read tags with
              no
              problem at all.
              >
              Writing to the tags seems a whole different ball game.
              >
              I will keep trying.
              >
              Anymore suggestions would be welcome.
              >
              If I find away to make this work i will post the soloution.
              >
              Great New group by the way I will try and participate
              >
              Thanks again for the suggestions
              >
              Roger
              >
              "Joy" <Joy@discussion s.microsoft.com wrote in message
              news:8A42F91A-C1ED-4594-9CC4-8D6985C73E02@mi crosoft.com...
              Hi Roger,
              Let me know if the following link was of any help to you:



              regards,
              Joy

              "Roger" wrote:

              Hi all
              >
              I have managed read metadata from an image file using BitmapMetaData,
              and
              that works fine,
              >
              but I am having trouble finding out how to write the information back
              to
              the
              Image
              >
              can anyone help with this please
              >
              Thanks in advance
              >
              Roger
              >
              >
              >

              Comment

              • =?Utf-8?B?Sm95?=

                #8
                Re: BitmapMetadata

                Hi Roger,
                I tried the code given on MSDN on the following Url:

                Learn how to how to write metadata to a bitmap using the metadata query language.


                And it was running perfectly for me, so please let me know which version of
                ..NET are you using and also what is the specific error\exception that you
                have been getting.

                regards,
                Joy

                "Roger" wrote:
                Code I have used so far
                >
                This is the class i have for reding the data which works fine
                <snip>
                using System.Windows. Media.Imaging;
                using System.IO;
                <snip>
                >
                /// <summary>
                /// Returns Image MetaData Preformated in a table
                /// using System.Windows. Media.Imaging (ref)
                /// dot.net 3.5 standard
                ///
                /// </summary>
                >
                public static string returnMetaData( string imgFile)
                {
                string MetaData = null;
                >
                >
                >
                >
                BitmapSource img = BitmapFrame.Cre ate(new Uri(imgFile));
                BitmapMetadata meta = (BitmapMetadata )img.Metadata;
                // MetaData
                MetaData += "Title: " + meta.Title + Environment.New Line;
                MetaData += "Subject: " + meta.Subject + Environment.New Line;
                MetaData += "Comment: " + meta.Comment + Environment.New Line;
                MetaData += "Date taken: " + meta.DateTaken +
                Environment.New Line;
                MetaData += "Authors: " + meta.Author + Environment.New Line;
                >
                /* Image data */
                double mpixel = (img.PixelHeigh t * img.PixelWidth) /
                (double)1000000 ;
                MetaData +="Image Width: "+ img.PixelWidth + "px"+
                Environment.New Line;
                MetaData +="Image Height: "+ img.PixelHeight + "px"+
                Environment.New Line;
                MetaData +="Megapixels : " + mpixel + Environment.New Line;
                MetaData += "DPI: " + img.DpiX + img.DpiY +Environment.Ne wLine;
                >
                // More Metadata
                MetaData += "Camera Maker: " + meta.CameraManu facturer +
                Environment.New Line;
                MetaData += "Camera Model: " + meta.CameraMode l +
                Environment.New Line;
                MetaData += "Edited in: " + meta.Applicatio nName +
                Environment.New Line;
                MetaData += "Copyright: " + meta.Copyright +
                Environment.New Line;
                >
                // remove unsafe characters for ajax postback
                >
                MetaData = MetaData.Replac e ("<","");
                MetaData = MetaData.Replac e (">","");
                return MetaData ;
                >
                }
                >
                >
                >
                This is the code i have been trying to write the data with out sucess
                >
                imageFile = "c://users//roger//documents//test.jpg";
                bool done = true;
                Stream jpgStream = new System.IO.FileS tream(imageFile ,
                FileMode.Open, FileAccess.Read Write, FileShare.ReadW rite);
                JpegBitmapDecod er jpgDecoder = new JpegBitmapDecod er(jpgStream,
                BitmapCreateOpt ions.PreservePi xelFormat, BitmapCacheOpti on.Default);
                BitmapFrame jpgFrame = jpgDecoder.Fram es[0];
                InPlaceBitmapMe tadataWriter jpgInplace =
                jpgFrame.Create InPlaceBitmapMe tadataWriter();
                if (jpgInplace.Try Save() == true)
                {
                >
                jpgInplace.SetQ uery("/Text/Title", "Have a nice day");
                }
                jpgStream.Close ();
                --------------------------------------------------------------------------------------------------------
                >
                >
                "Joy" <Joy@discussion s.microsoft.com wrote in message
                news:700B6A65-009D-4080-AB98-F51B85BC5CC7@mi crosoft.com...
                Hi Roger,
                Can you post the code piece so that i will have more clarity on as to what
                are you trying to do and hence will be more accomplished to give my inputs
                for the same.

                regards,
                Joy

                "Roger" wrote:
                Thanks for the link.
                >
                I have looked there and tried a few examples that i have found oround the
                net.
                >
                It seems that its all a little sketchy, and i have yet to find any one
                who
                have got this to work.
                >
                I have found a c# libray which i am looking into now but it seems that
                the
                EXIF standard and MS standard are different.
                >
                If you change the tags in Vista they do not seem to match the EXIF
                format.
                >
                I have spent the weekend looking into this and am able to read tags with
                no
                problem at all.
                >
                Writing to the tags seems a whole different ball game.
                >
                I will keep trying.
                >
                Anymore suggestions would be welcome.
                >
                If I find away to make this work i will post the soloution.
                >
                Great New group by the way I will try and participate
                >
                Thanks again for the suggestions
                >
                Roger
                >
                "Joy" <Joy@discussion s.microsoft.com wrote in message
                news:8A42F91A-C1ED-4594-9CC4-8D6985C73E02@mi crosoft.com...
                Hi Roger,
                Let me know if the following link was of any help to you:



                regards,
                Joy

                "Roger" wrote:

                Hi all
                >
                I have managed read metadata from an image file using BitmapMetaData,
                and
                that works fine,
                >
                but I am having trouble finding out how to write the information back
                to
                the
                Image
                >
                can anyone help with this please
                >
                Thanks in advance
                >
                Roger
                >
                >
                >

                Comment

                • Roger

                  #9
                  Re: BitmapMetadata

                  Sorry I Have been away.

                  Anyway .net 3.5 and the code you suggested is what i have used except i have
                  change it from tiff to jpeg

                  I have read the skimpy examples the msdn provides.

                  Did you try it with a jpeg?

                  Thanks


                  Roger

                  "Joy" <Joy@discussion s.microsoft.com wrote in message
                  news:63DB352F-603C-4658-A09F-F37A1FD39EEE@mi crosoft.com...
                  Hi Roger,
                  I tried the code given on MSDN on the following Url:
                  >
                  Learn how to how to write metadata to a bitmap using the metadata query language.

                  >
                  And it was running perfectly for me, so please let me know which version
                  of
                  .NET are you using and also what is the specific error\exception that you
                  have been getting.
                  >
                  regards,
                  Joy
                  >
                  "Roger" wrote:
                  >
                  >Code I have used so far
                  >>
                  >This is the class i have for reding the data which works fine
                  ><snip>
                  >using System.Windows. Media.Imaging;
                  >using System.IO;
                  ><snip>
                  >>
                  > /// <summary>
                  > /// Returns Image MetaData Preformated in a table
                  > /// using System.Windows. Media.Imaging (ref)
                  > /// dot.net 3.5 standard
                  > ///
                  > /// </summary>
                  >>
                  > public static string returnMetaData( string imgFile)
                  > {
                  > string MetaData = null;
                  >>
                  >>
                  >>
                  >>
                  > BitmapSource img = BitmapFrame.Cre ate(new Uri(imgFile));
                  > BitmapMetadata meta = (BitmapMetadata )img.Metadata;
                  > // MetaData
                  > MetaData += "Title: " + meta.Title + Environment.New Line;
                  > MetaData += "Subject: " + meta.Subject + Environment.New Line;
                  > MetaData += "Comment: " + meta.Comment + Environment.New Line;
                  > MetaData += "Date taken: " + meta.DateTaken +
                  >Environment.Ne wLine;
                  > MetaData += "Authors: " + meta.Author + Environment.New Line;
                  >>
                  > /* Image data */
                  > double mpixel = (img.PixelHeigh t * img.PixelWidth) /
                  >(double)100000 0;
                  > MetaData +="Image Width: "+ img.PixelWidth + "px"+
                  >Environment.Ne wLine;
                  > MetaData +="Image Height: "+ img.PixelHeight + "px"+
                  >Environment.Ne wLine;
                  > MetaData +="Megapixels : " + mpixel + Environment.New Line;
                  > MetaData += "DPI: " + img.DpiX + img.DpiY
                  >+Environment.N ewLine;
                  >>
                  > // More Metadata
                  > MetaData += "Camera Maker: " + meta.CameraManu facturer +
                  >Environment.Ne wLine;
                  > MetaData += "Camera Model: " + meta.CameraMode l +
                  >Environment.Ne wLine;
                  > MetaData += "Edited in: " + meta.Applicatio nName +
                  >Environment.Ne wLine;
                  > MetaData += "Copyright: " + meta.Copyright +
                  >Environment.Ne wLine;
                  >>
                  > // remove unsafe characters for ajax postback
                  >>
                  > MetaData = MetaData.Replac e ("<","");
                  > MetaData = MetaData.Replac e (">","");
                  > return MetaData ;
                  >>
                  > }
                  >>
                  >>
                  >>
                  >This is the code i have been trying to write the data with out sucess
                  >>
                  >imageFile = "c://users//roger//documents//test.jpg";
                  > bool done = true;
                  > Stream jpgStream = new System.IO.FileS tream(imageFile ,
                  >FileMode.Ope n, FileAccess.Read Write, FileShare.ReadW rite);
                  > JpegBitmapDecod er jpgDecoder = new
                  >JpegBitmapDeco der(jpgStream,
                  >BitmapCreateOp tions.PreserveP ixelFormat, BitmapCacheOpti on.Default);
                  > BitmapFrame jpgFrame = jpgDecoder.Fram es[0];
                  > InPlaceBitmapMe tadataWriter jpgInplace =
                  >jpgFrame.Creat eInPlaceBitmapM etadataWriter() ;
                  > if (jpgInplace.Try Save() == true)
                  > {
                  >>
                  > jpgInplace.SetQ uery("/Text/Title", "Have a nice day");
                  > }
                  > jpgStream.Close ();
                  >--------------------------------------------------------------------------------------------------------
                  >>
                  >>
                  >"Joy" <Joy@discussion s.microsoft.com wrote in message
                  >news:700B6A6 5-009D-4080-AB98-F51B85BC5CC7@mi crosoft.com...
                  Hi Roger,
                  Can you post the code piece so that i will have more clarity on as to
                  what
                  are you trying to do and hence will be more accomplished to give my
                  inputs
                  for the same.
                  >
                  regards,
                  Joy
                  >
                  "Roger" wrote:
                  >
                  >Thanks for the link.
                  >>
                  >I have looked there and tried a few examples that i have found oround
                  >the
                  >net.
                  >>
                  >It seems that its all a little sketchy, and i have yet to find any one
                  >who
                  >have got this to work.
                  >>
                  >I have found a c# libray which i am looking into now but it seems that
                  >the
                  >EXIF standard and MS standard are different.
                  >>
                  >If you change the tags in Vista they do not seem to match the EXIF
                  >format.
                  >>
                  >I have spent the weekend looking into this and am able to read tags
                  >with
                  >no
                  >problem at all.
                  >>
                  >Writing to the tags seems a whole different ball game.
                  >>
                  >I will keep trying.
                  >>
                  >Anymore suggestions would be welcome.
                  >>
                  >If I find away to make this work i will post the soloution.
                  >>
                  >Great New group by the way I will try and participate
                  >>
                  >Thanks again for the suggestions
                  >>
                  >Roger
                  >>
                  >"Joy" <Joy@discussion s.microsoft.com wrote in message
                  >news:8A42F91 A-C1ED-4594-9CC4-8D6985C73E02@mi crosoft.com...
                  Hi Roger,
                  Let me know if the following link was of any help to you:
                  >

                  >
                  regards,
                  Joy
                  >
                  "Roger" wrote:
                  >
                  >Hi all
                  >>
                  >I have managed read metadata from an image file using
                  >BitmapMetaData ,
                  >and
                  >that works fine,
                  >>
                  >but I am having trouble finding out how to write the information
                  >back
                  >to
                  >the
                  >Image
                  >>
                  >can anyone help with this please
                  >>
                  >Thanks in advance
                  >>
                  >Roger
                  >>
                  >>
                  >>

                  Comment

                  • =?Utf-8?B?Sm95?=

                    #10
                    Re: BitmapMetadata

                    Hi Roger,
                    Perhaps i have figured out why is it not working for you when you are
                    dealing with JPEG file, as in my case it works perfectly even for JPG file. :)

                    Please do the following:
                    1. Open the solution explorer.
                    2. Make sure that the JPG file gets copied to the Bin folder of the
                    application. This is how you can make sure that: right click the JPG file in
                    the solution explorer and click on Properties and then set the following
                    properties:
                    a) Build Action - Content
                    b) Copy to Output Directory - Copy always

                    Please note here that i have also tried the same code with reading the file
                    from a location other than the application directory e.g. c:\\smiley.jpg and
                    it worked perfectly in that case as well.

                    Please let me know if it worked for you.

                    regards,
                    Joy

                    "Roger" wrote:
                    Sorry I Have been away.
                    >
                    Anyway .net 3.5 and the code you suggested is what i have used except i have
                    change it from tiff to jpeg
                    >
                    I have read the skimpy examples the msdn provides.
                    >
                    Did you try it with a jpeg?
                    >
                    Thanks
                    >
                    >
                    Roger
                    >
                    "Joy" <Joy@discussion s.microsoft.com wrote in message
                    news:63DB352F-603C-4658-A09F-F37A1FD39EEE@mi crosoft.com...
                    Hi Roger,
                    I tried the code given on MSDN on the following Url:

                    Learn how to how to write metadata to a bitmap using the metadata query language.


                    And it was running perfectly for me, so please let me know which version
                    of
                    .NET are you using and also what is the specific error\exception that you
                    have been getting.

                    regards,
                    Joy

                    "Roger" wrote:
                    Code I have used so far
                    >
                    This is the class i have for reding the data which works fine
                    <snip>
                    using System.Windows. Media.Imaging;
                    using System.IO;
                    <snip>
                    >
                    /// <summary>
                    /// Returns Image MetaData Preformated in a table
                    /// using System.Windows. Media.Imaging (ref)
                    /// dot.net 3.5 standard
                    ///
                    /// </summary>
                    >
                    public static string returnMetaData( string imgFile)
                    {
                    string MetaData = null;
                    >
                    >
                    >
                    >
                    BitmapSource img = BitmapFrame.Cre ate(new Uri(imgFile));
                    BitmapMetadata meta = (BitmapMetadata )img.Metadata;
                    // MetaData
                    MetaData += "Title: " + meta.Title + Environment.New Line;
                    MetaData += "Subject: " + meta.Subject + Environment.New Line;
                    MetaData += "Comment: " + meta.Comment + Environment.New Line;
                    MetaData += "Date taken: " + meta.DateTaken +
                    Environment.New Line;
                    MetaData += "Authors: " + meta.Author + Environment.New Line;
                    >
                    /* Image data */
                    double mpixel = (img.PixelHeigh t * img.PixelWidth) /
                    (double)1000000 ;
                    MetaData +="Image Width: "+ img.PixelWidth + "px"+
                    Environment.New Line;
                    MetaData +="Image Height: "+ img.PixelHeight + "px"+
                    Environment.New Line;
                    MetaData +="Megapixels : " + mpixel + Environment.New Line;
                    MetaData += "DPI: " + img.DpiX + img.DpiY
                    +Environment.Ne wLine;
                    >
                    // More Metadata
                    MetaData += "Camera Maker: " + meta.CameraManu facturer +
                    Environment.New Line;
                    MetaData += "Camera Model: " + meta.CameraMode l +
                    Environment.New Line;
                    MetaData += "Edited in: " + meta.Applicatio nName +
                    Environment.New Line;
                    MetaData += "Copyright: " + meta.Copyright +
                    Environment.New Line;
                    >
                    // remove unsafe characters for ajax postback
                    >
                    MetaData = MetaData.Replac e ("<","");
                    MetaData = MetaData.Replac e (">","");
                    return MetaData ;
                    >
                    }
                    >
                    >
                    >
                    This is the code i have been trying to write the data with out sucess
                    >
                    imageFile = "c://users//roger//documents//test.jpg";
                    bool done = true;
                    Stream jpgStream = new System.IO.FileS tream(imageFile ,
                    FileMode.Open, FileAccess.Read Write, FileShare.ReadW rite);
                    JpegBitmapDecod er jpgDecoder = new
                    JpegBitmapDecod er(jpgStream,
                    BitmapCreateOpt ions.PreservePi xelFormat, BitmapCacheOpti on.Default);
                    BitmapFrame jpgFrame = jpgDecoder.Fram es[0];
                    InPlaceBitmapMe tadataWriter jpgInplace =
                    jpgFrame.Create InPlaceBitmapMe tadataWriter();
                    if (jpgInplace.Try Save() == true)
                    {
                    >
                    jpgInplace.SetQ uery("/Text/Title", "Have a nice day");
                    }
                    jpgStream.Close ();
                    --------------------------------------------------------------------------------------------------------
                    >
                    >
                    "Joy" <Joy@discussion s.microsoft.com wrote in message
                    news:700B6A65-009D-4080-AB98-F51B85BC5CC7@mi crosoft.com...
                    Hi Roger,
                    Can you post the code piece so that i will have more clarity on as to
                    what
                    are you trying to do and hence will be more accomplished to give my
                    inputs
                    for the same.

                    regards,
                    Joy

                    "Roger" wrote:

                    Thanks for the link.
                    >
                    I have looked there and tried a few examples that i have found oround
                    the
                    net.
                    >
                    It seems that its all a little sketchy, and i have yet to find any one
                    who
                    have got this to work.
                    >
                    I have found a c# libray which i am looking into now but it seems that
                    the
                    EXIF standard and MS standard are different.
                    >
                    If you change the tags in Vista they do not seem to match the EXIF
                    format.
                    >
                    I have spent the weekend looking into this and am able to read tags
                    with
                    no
                    problem at all.
                    >
                    Writing to the tags seems a whole different ball game.
                    >
                    I will keep trying.
                    >
                    Anymore suggestions would be welcome.
                    >
                    If I find away to make this work i will post the soloution.
                    >
                    Great New group by the way I will try and participate
                    >
                    Thanks again for the suggestions
                    >
                    Roger
                    >
                    "Joy" <Joy@discussion s.microsoft.com wrote in message
                    news:8A42F91A-C1ED-4594-9CC4-8D6985C73E02@mi crosoft.com...
                    Hi Roger,
                    Let me know if the following link was of any help to you:



                    regards,
                    Joy

                    "Roger" wrote:

                    Hi all
                    >
                    I have managed read metadata from an image file using
                    BitmapMetaData,
                    and
                    that works fine,
                    >
                    but I am having trouble finding out how to write the information
                    back
                    to
                    the
                    Image
                    >
                    can anyone help with this please
                    >
                    Thanks in advance
                    >
                    Roger
                    >
                    >
                    >
                    >

                    Comment

                    • Roger

                      #11
                      Re: BitmapMetadata

                      I will have another look,
                      I will have to read from a directory outside the applicaton as this is being
                      used as a web application and the image will be uploaded to the server.

                      Just for information

                      Also i have discovered that when you read the metadata using the example in
                      the msdn, that the code apprears to lock the file so you can not access it
                      to write any data, or delete the file.

                      I have used this instead

                      public static string getMetadata(str ing imageFile)
                      {

                      string msMetaData = null;


                      // get windows MetaData
                      FileStream fs = new FileStream(imag eFile, FileMode.Open,
                      FileAccess.Read , FileShare.Read) ;
                      BitmapSource img = BitmapFrame.Cre ate(fs);


                      BitmapMetadata meta = (BitmapMetadata )img.Metadata;
                      // MetaData
                      msMetaData += "Title: " + meta.Title + Environment.New Line;
                      msMetaData += "Subject: " + meta.Subject + Environment.New Line;
                      msMetaData += "Comment: " + meta.Comment + Environment.New Line;
                      msMetaData += "Date taken: " + meta.DateTaken +
                      Environment.New Line;
                      msMetaData += "Authors: " + meta.Author + Environment.New Line;

                      /* Image data */
                      double mpixel = (img.PixelHeigh t * img.PixelWidth) /
                      (double)1000000 ;
                      msMetaData += "Image Width: " + img.PixelWidth + "px" +
                      Environment.New Line;
                      msMetaData += "Image Height: " + img.PixelHeight + "px" +
                      Environment.New Line;
                      msMetaData += "Megapixels : " + mpixel + Environment.New Line;
                      msMetaData += "DPI: " + img.DpiX + img.DpiY +
                      Environment.New Line;

                      // More Metadata
                      msMetaData += "Camera Maker: " + meta.CameraManu facturer +
                      Environment.New Line;
                      msMetaData += "Camera Model: " + meta.CameraMode l +
                      Environment.New Line;
                      msMetaData += "Edited in: " + meta.Applicatio nName +
                      Environment.New Line;
                      msMetaData += "Copyright: " + meta.Copyright +
                      Environment.New Line;

                      // remove unsafe characters for ajax postback

                      msMetaData = msMetaData.Repl ace("<", "");
                      msMetaData = msMetaData.Repl ace(">", "");

                      fs.Dispose();
                      return msMetaData;
                      }

                      I will let you know how I get on over the weekend.

                      Roger
                      "Joy" <Joy@discussion s.microsoft.com wrote in message
                      news:E00A86A4-59F8-4605-A6DE-CD9071CF2F25@mi crosoft.com...
                      Hi Roger,
                      Perhaps i have figured out why is it not working for you when you are
                      dealing with JPEG file, as in my case it works perfectly even for JPG
                      file. :)
                      >
                      Please do the following:
                      1. Open the solution explorer.
                      2. Make sure that the JPG file gets copied to the Bin folder of the
                      application. This is how you can make sure that: right click the JPG file
                      in
                      the solution explorer and click on Properties and then set the following
                      properties:
                      a) Build Action - Content
                      b) Copy to Output Directory - Copy always
                      >
                      Please note here that i have also tried the same code with reading the
                      file
                      from a location other than the application directory e.g. c:\\smiley.jpg
                      and
                      it worked perfectly in that case as well.
                      >
                      Please let me know if it worked for you.
                      >
                      regards,
                      Joy
                      >
                      "Roger" wrote:
                      >
                      >Sorry I Have been away.
                      >>
                      >Anyway .net 3.5 and the code you suggested is what i have used except i
                      >have
                      >change it from tiff to jpeg
                      >>
                      >I have read the skimpy examples the msdn provides.
                      >>
                      >Did you try it with a jpeg?
                      >>
                      >Thanks
                      >>
                      >>
                      >Roger
                      >>
                      >"Joy" <Joy@discussion s.microsoft.com wrote in message
                      >news:63DB352 F-603C-4658-A09F-F37A1FD39EEE@mi crosoft.com...
                      Hi Roger,
                      I tried the code given on MSDN on the following Url:
                      >
                      Learn how to how to write metadata to a bitmap using the metadata query language.

                      >
                      And it was running perfectly for me, so please let me know which
                      version
                      of
                      .NET are you using and also what is the specific error\exception that
                      you
                      have been getting.
                      >
                      regards,
                      Joy
                      >
                      "Roger" wrote:
                      >
                      >Code I have used so far
                      >>
                      >This is the class i have for reding the data which works fine
                      ><snip>
                      >using System.Windows. Media.Imaging;
                      >using System.IO;
                      ><snip>
                      >>
                      > /// <summary>
                      > /// Returns Image MetaData Preformated in a table
                      > /// using System.Windows. Media.Imaging (ref)
                      > /// dot.net 3.5 standard
                      > ///
                      > /// </summary>
                      >>
                      > public static string returnMetaData( string imgFile)
                      > {
                      > string MetaData = null;
                      >>
                      >>
                      >>
                      >>
                      > BitmapSource img = BitmapFrame.Cre ate(new Uri(imgFile));
                      > BitmapMetadata meta = (BitmapMetadata )img.Metadata;
                      > // MetaData
                      > MetaData += "Title: " + meta.Title + Environment.New Line;
                      > MetaData += "Subject: " + meta.Subject +
                      >Environment.Ne wLine;
                      > MetaData += "Comment: " + meta.Comment +
                      >Environment.Ne wLine;
                      > MetaData += "Date taken: " + meta.DateTaken +
                      >Environment.Ne wLine;
                      > MetaData += "Authors: " + meta.Author +
                      >Environment.Ne wLine;
                      >>
                      > /* Image data */
                      > double mpixel = (img.PixelHeigh t * img.PixelWidth) /
                      >(double)100000 0;
                      > MetaData +="Image Width: "+ img.PixelWidth + "px"+
                      >Environment.Ne wLine;
                      > MetaData +="Image Height: "+ img.PixelHeight + "px"+
                      >Environment.Ne wLine;
                      > MetaData +="Megapixels : " + mpixel + Environment.New Line;
                      > MetaData += "DPI: " + img.DpiX + img.DpiY
                      >+Environment.N ewLine;
                      >>
                      > // More Metadata
                      > MetaData += "Camera Maker: " + meta.CameraManu facturer +
                      >Environment.Ne wLine;
                      > MetaData += "Camera Model: " + meta.CameraMode l +
                      >Environment.Ne wLine;
                      > MetaData += "Edited in: " + meta.Applicatio nName +
                      >Environment.Ne wLine;
                      > MetaData += "Copyright: " + meta.Copyright +
                      >Environment.Ne wLine;
                      >>
                      > // remove unsafe characters for ajax postback
                      >>
                      > MetaData = MetaData.Replac e ("<","");
                      > MetaData = MetaData.Replac e (">","");
                      > return MetaData ;
                      >>
                      > }
                      >>
                      >>
                      >>
                      >This is the code i have been trying to write the data with out sucess
                      >>
                      >imageFile = "c://users//roger//documents//test.jpg";
                      > bool done = true;
                      > Stream jpgStream = new System.IO.FileS tream(imageFile ,
                      >FileMode.Ope n, FileAccess.Read Write, FileShare.ReadW rite);
                      > JpegBitmapDecod er jpgDecoder = new
                      >JpegBitmapDeco der(jpgStream,
                      >BitmapCreateOp tions.PreserveP ixelFormat, BitmapCacheOpti on.Default);
                      > BitmapFrame jpgFrame = jpgDecoder.Fram es[0];
                      > InPlaceBitmapMe tadataWriter jpgInplace =
                      >jpgFrame.Creat eInPlaceBitmapM etadataWriter() ;
                      > if (jpgInplace.Try Save() == true)
                      > {
                      >>
                      > jpgInplace.SetQ uery("/Text/Title", "Have a nice day");
                      > }
                      > jpgStream.Close ();
                      >--------------------------------------------------------------------------------------------------------
                      >>
                      >>
                      >"Joy" <Joy@discussion s.microsoft.com wrote in message
                      >news:700B6A6 5-009D-4080-AB98-F51B85BC5CC7@mi crosoft.com...
                      Hi Roger,
                      Can you post the code piece so that i will have more clarity on as
                      to
                      what
                      are you trying to do and hence will be more accomplished to give my
                      inputs
                      for the same.
                      >
                      regards,
                      Joy
                      >
                      "Roger" wrote:
                      >
                      >Thanks for the link.
                      >>
                      >I have looked there and tried a few examples that i have found
                      >oround
                      >the
                      >net.
                      >>
                      >It seems that its all a little sketchy, and i have yet to find any
                      >one
                      >who
                      >have got this to work.
                      >>
                      >I have found a c# libray which i am looking into now but it seems
                      >that
                      >the
                      >EXIF standard and MS standard are different.
                      >>
                      >If you change the tags in Vista they do not seem to match the EXIF
                      >format.
                      >>
                      >I have spent the weekend looking into this and am able to read tags
                      >with
                      >no
                      >problem at all.
                      >>
                      >Writing to the tags seems a whole different ball game.
                      >>
                      >I will keep trying.
                      >>
                      >Anymore suggestions would be welcome.
                      >>
                      >If I find away to make this work i will post the soloution.
                      >>
                      >Great New group by the way I will try and participate
                      >>
                      >Thanks again for the suggestions
                      >>
                      >Roger
                      >>
                      >"Joy" <Joy@discussion s.microsoft.com wrote in message
                      >news:8A42F91 A-C1ED-4594-9CC4-8D6985C73E02@mi crosoft.com...
                      Hi Roger,
                      Let me know if the following link was of any help to you:
                      >

                      >
                      regards,
                      Joy
                      >
                      "Roger" wrote:
                      >
                      >Hi all
                      >>
                      >I have managed read metadata from an image file using
                      >BitmapMetaData ,
                      >and
                      >that works fine,
                      >>
                      >but I am having trouble finding out how to write the information
                      >back
                      >to
                      >the
                      >Image
                      >>
                      >can anyone help with this please
                      >>
                      >Thanks in advance
                      >>
                      >Roger
                      >>
                      >>
                      >>
                      >>

                      Comment

                      • Roger

                        #12
                        Re: BitmapMetadata

                        It may be worth reading this


                        as it looks like this is all a little flawed and un reliable if there is not
                        enough space in the file, so looks like you have to copy the jpg and rewirte
                        the whole thing.

                        Anyway Jay has said it works, I have run it and it does not error but there
                        are no changes in the data :(


                        Roger

                        "Roger" <roger@barretti nteriors.co.ukw rote in message
                        news:D0C67396-4EF2-4BC9-B161-854ABB05165F@mi crosoft.com...
                        >I will have another look,
                        I will have to read from a directory outside the applicaton as this is
                        being used as a web application and the image will be uploaded to the
                        server.
                        >
                        Just for information
                        >
                        Also i have discovered that when you read the metadata using the example
                        in the msdn, that the code apprears to lock the file so you can not access
                        it to write any data, or delete the file.
                        >
                        I have used this instead
                        >
                        public static string getMetadata(str ing imageFile)
                        {
                        >
                        string msMetaData = null;
                        >
                        >
                        // get windows MetaData
                        FileStream fs = new FileStream(imag eFile, FileMode.Open,
                        FileAccess.Read , FileShare.Read) ;
                        BitmapSource img = BitmapFrame.Cre ate(fs);
                        >
                        >
                        BitmapMetadata meta = (BitmapMetadata )img.Metadata;
                        // MetaData
                        msMetaData += "Title: " + meta.Title + Environment.New Line;
                        msMetaData += "Subject: " + meta.Subject + Environment.New Line;
                        msMetaData += "Comment: " + meta.Comment + Environment.New Line;
                        msMetaData += "Date taken: " + meta.DateTaken +
                        Environment.New Line;
                        msMetaData += "Authors: " + meta.Author + Environment.New Line;
                        >
                        /* Image data */
                        double mpixel = (img.PixelHeigh t * img.PixelWidth) /
                        (double)1000000 ;
                        msMetaData += "Image Width: " + img.PixelWidth + "px" +
                        Environment.New Line;
                        msMetaData += "Image Height: " + img.PixelHeight + "px" +
                        Environment.New Line;
                        msMetaData += "Megapixels : " + mpixel + Environment.New Line;
                        msMetaData += "DPI: " + img.DpiX + img.DpiY +
                        Environment.New Line;
                        >
                        // More Metadata
                        msMetaData += "Camera Maker: " + meta.CameraManu facturer +
                        Environment.New Line;
                        msMetaData += "Camera Model: " + meta.CameraMode l +
                        Environment.New Line;
                        msMetaData += "Edited in: " + meta.Applicatio nName +
                        Environment.New Line;
                        msMetaData += "Copyright: " + meta.Copyright +
                        Environment.New Line;
                        >
                        // remove unsafe characters for ajax postback
                        >
                        msMetaData = msMetaData.Repl ace("<", "");
                        msMetaData = msMetaData.Repl ace(">", "");
                        >
                        fs.Dispose();
                        return msMetaData;
                        }
                        >
                        I will let you know how I get on over the weekend.
                        >
                        Roger
                        "Joy" <Joy@discussion s.microsoft.com wrote in message
                        news:E00A86A4-59F8-4605-A6DE-CD9071CF2F25@mi crosoft.com...
                        >Hi Roger,
                        >Perhaps i have figured out why is it not working for you when you are
                        >dealing with JPEG file, as in my case it works perfectly even for JPG
                        >file. :)
                        >>
                        >Please do the following:
                        >1. Open the solution explorer.
                        >2. Make sure that the JPG file gets copied to the Bin folder of the
                        >application. This is how you can make sure that: right click the JPG file
                        >in
                        >the solution explorer and click on Properties and then set the following
                        >properties:
                        >a) Build Action - Content
                        >b) Copy to Output Directory - Copy always
                        >>
                        >Please note here that i have also tried the same code with reading the
                        >file
                        >from a location other than the application directory e.g. c:\\smiley.jpg
                        >and
                        >it worked perfectly in that case as well.
                        >>
                        >Please let me know if it worked for you.
                        >>
                        >regards,
                        >Joy
                        >>
                        >"Roger" wrote:
                        >>
                        >>Sorry I Have been away.
                        >>>
                        >>Anyway .net 3.5 and the code you suggested is what i have used except i
                        >>have
                        >>change it from tiff to jpeg
                        >>>
                        >>I have read the skimpy examples the msdn provides.
                        >>>
                        >>Did you try it with a jpeg?
                        >>>
                        >>Thanks
                        >>>
                        >>>
                        >>Roger
                        >>>
                        >>"Joy" <Joy@discussion s.microsoft.com wrote in message
                        >>news:63DB35 2F-603C-4658-A09F-F37A1FD39EEE@mi crosoft.com...
                        >Hi Roger,
                        >I tried the code given on MSDN on the following Url:
                        >>
                        >http://msdn.microsoft.com/en-us/library/aa970450.aspx
                        >>
                        >And it was running perfectly for me, so please let me know which
                        >version
                        >of
                        >.NET are you using and also what is the specific error\exception that
                        >you
                        >have been getting.
                        >>
                        >regards,
                        >Joy
                        >>
                        >"Roger" wrote:
                        >>
                        >>Code I have used so far
                        >>>
                        >>This is the class i have for reding the data which works fine
                        >><snip>
                        >>using System.Windows. Media.Imaging;
                        >>using System.IO;
                        >><snip>
                        >>>
                        >> /// <summary>
                        >> /// Returns Image MetaData Preformated in a table
                        >> /// using System.Windows. Media.Imaging (ref)
                        >> /// dot.net 3.5 standard
                        >> ///
                        >> /// </summary>
                        >>>
                        >> public static string returnMetaData( string imgFile)
                        >> {
                        >> string MetaData = null;
                        >>>
                        >>>
                        >>>
                        >>>
                        >> BitmapSource img = BitmapFrame.Cre ate(new Uri(imgFile));
                        >> BitmapMetadata meta = (BitmapMetadata )img.Metadata;
                        >> // MetaData
                        >> MetaData += "Title: " + meta.Title + Environment.New Line;
                        >> MetaData += "Subject: " + meta.Subject +
                        >>Environment.N ewLine;
                        >> MetaData += "Comment: " + meta.Comment +
                        >>Environment.N ewLine;
                        >> MetaData += "Date taken: " + meta.DateTaken +
                        >>Environment.N ewLine;
                        >> MetaData += "Authors: " + meta.Author +
                        >>Environment.N ewLine;
                        >>>
                        >> /* Image data */
                        >> double mpixel = (img.PixelHeigh t * img.PixelWidth) /
                        >>(double)10000 00;
                        >> MetaData +="Image Width: "+ img.PixelWidth + "px"+
                        >>Environment.N ewLine;
                        >> MetaData +="Image Height: "+ img.PixelHeight + "px"+
                        >>Environment.N ewLine;
                        >> MetaData +="Megapixels : " + mpixel +
                        >>Environment.N ewLine;
                        >> MetaData += "DPI: " + img.DpiX + img.DpiY
                        >>+Environment. NewLine;
                        >>>
                        >> // More Metadata
                        >> MetaData += "Camera Maker: " + meta.CameraManu facturer +
                        >>Environment.N ewLine;
                        >> MetaData += "Camera Model: " + meta.CameraMode l +
                        >>Environment.N ewLine;
                        >> MetaData += "Edited in: " + meta.Applicatio nName +
                        >>Environment.N ewLine;
                        >> MetaData += "Copyright: " + meta.Copyright +
                        >>Environment.N ewLine;
                        >>>
                        >> // remove unsafe characters for ajax postback
                        >>>
                        >> MetaData = MetaData.Replac e ("<","");
                        >> MetaData = MetaData.Replac e (">","");
                        >> return MetaData ;
                        >>>
                        >> }
                        >>>
                        >>>
                        >>>
                        >>This is the code i have been trying to write the data with out sucess
                        >>>
                        >>imageFile = "c://users//roger//documents//test.jpg";
                        >> bool done = true;
                        >> Stream jpgStream = new System.IO.FileS tream(imageFile ,
                        >>FileMode.Open , FileAccess.Read Write, FileShare.ReadW rite);
                        >> JpegBitmapDecod er jpgDecoder = new
                        >>JpegBitmapDec oder(jpgStream,
                        >>BitmapCreateO ptions.Preserve PixelFormat, BitmapCacheOpti on.Default);
                        >> BitmapFrame jpgFrame = jpgDecoder.Fram es[0];
                        >> InPlaceBitmapMe tadataWriter jpgInplace =
                        >>jpgFrame.Crea teInPlaceBitmap MetadataWriter( );
                        >> if (jpgInplace.Try Save() == true)
                        >> {
                        >>>
                        >> jpgInplace.SetQ uery("/Text/Title", "Have a nice
                        >>day");
                        >> }
                        >> jpgStream.Close ();
                        >>--------------------------------------------------------------------------------------------------------
                        >>>
                        >>>
                        >>"Joy" <Joy@discussion s.microsoft.com wrote in message
                        >>news:700B6A 65-009D-4080-AB98-F51B85BC5CC7@mi crosoft.com...
                        >Hi Roger,
                        >Can you post the code piece so that i will have more clarity on as
                        >to
                        >what
                        >are you trying to do and hence will be more accomplished to give my
                        >inputs
                        >for the same.
                        >>
                        >regards,
                        >Joy
                        >>
                        >"Roger" wrote:
                        >>
                        >>Thanks for the link.
                        >>>
                        >>I have looked there and tried a few examples that i have found
                        >>oround
                        >>the
                        >>net.
                        >>>
                        >>It seems that its all a little sketchy, and i have yet to find any
                        >>one
                        >>who
                        >>have got this to work.
                        >>>
                        >>I have found a c# libray which i am looking into now but it seems
                        >>that
                        >>the
                        >>EXIF standard and MS standard are different.
                        >>>
                        >>If you change the tags in Vista they do not seem to match the EXIF
                        >>format.
                        >>>
                        >>I have spent the weekend looking into this and am able to read
                        >>tags
                        >>with
                        >>no
                        >>problem at all.
                        >>>
                        >>Writing to the tags seems a whole different ball game.
                        >>>
                        >>I will keep trying.
                        >>>
                        >>Anymore suggestions would be welcome.
                        >>>
                        >>If I find away to make this work i will post the soloution.
                        >>>
                        >>Great New group by the way I will try and participate
                        >>>
                        >>Thanks again for the suggestions
                        >>>
                        >>Roger
                        >>>
                        >>"Joy" <Joy@discussion s.microsoft.com wrote in message
                        >>news:8A42F9 1A-C1ED-4594-9CC4-8D6985C73E02@mi crosoft.com...
                        >Hi Roger,
                        >Let me know if the following link was of any help to you:
                        >>
                        >http://msdn.microsoft.com/en-us/libr...pmetadata.aspx
                        >>
                        >regards,
                        >Joy
                        >>
                        >"Roger" wrote:
                        >>
                        >>Hi all
                        >>>
                        >>I have managed read metadata from an image file using
                        >>BitmapMetaDat a,
                        >>and
                        >>that works fine,
                        >>>
                        >>but I am having trouble finding out how to write the
                        >>information
                        >>back
                        >>to
                        >>the
                        >>Image
                        >>>
                        >>can anyone help with this please
                        >>>
                        >>Thanks in advance
                        >>>
                        >>Roger
                        >>>
                        >>>
                        >>>
                        >>>
                        >

                        Comment

                        Working...