<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Reading and Writing Tags for Photos in WPF</title>
	<atom:link href="http://blog.andreweichacker.com/2009/02/reading-and-writing-tags-for-photos-in-wpf/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.andreweichacker.com/2009/02/reading-and-writing-tags-for-photos-in-wpf/</link>
	<description>Andrew Eichacker</description>
	<lastBuildDate>Fri, 07 Oct 2011 17:08:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Robert Taubert</title>
		<link>http://blog.andreweichacker.com/2009/02/reading-and-writing-tags-for-photos-in-wpf/comment-page-1/#comment-5049</link>
		<dc:creator>Robert Taubert</dc:creator>
		<pubDate>Tue, 21 Sep 2010 14:35:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.andreweichacker.com/?p=128#comment-5049</guid>
		<description>In the SetUpMetadataOnImage sub you have the line:

output.Frames.Add(BitmapFrame.Create(frameCopy, frameCopy.Thumbnail, metadata, frameCopy.ColorContexts));original.Frames[0].ColorContexts));

which does not seem to be correct.  Can you give me the correct way to write that line?</description>
		<content:encoded><![CDATA[<p>In the SetUpMetadataOnImage sub you have the line:</p>
<p>output.Frames.Add(BitmapFrame.Create(frameCopy, frameCopy.Thumbnail, metadata, frameCopy.ColorContexts));original.Frames[0].ColorContexts));</p>
<p>which does not seem to be correct.  Can you give me the correct way to write that line?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Koshy</title>
		<link>http://blog.andreweichacker.com/2009/02/reading-and-writing-tags-for-photos-in-wpf/comment-page-1/#comment-4708</link>
		<dc:creator>Koshy</dc:creator>
		<pubDate>Fri, 27 Aug 2010 01:15:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.andreweichacker.com/?p=128#comment-4708</guid>
		<description>To help future readers, I&#039;d like to point out some intricacies to remember when dealing with the WPF metadata writer:

1. Make sure that your method that deals with the metadata is invoked on an STA apartment thread. Otherwise, you get some nasty COM exceptions. You can check if your method is running on STA by using the Thread.CurrentThread.GetApartmentState() call.

2. If you find that the file is getting smaller after writing metadata, just make sure that your Encoder compression setting is &quot;None&quot;. (See my previous comment).

3. If you find it hard to read an image file and write metadata to it, do it the simple way. Create a temporary file that is a copy of the original image. Load the image decoder using the temporary file and after filling in the metadata, write the encoder output to the original file. Then, you can delete the temporary file.

Hope this helps !</description>
		<content:encoded><![CDATA[<p>To help future readers, I&#8217;d like to point out some intricacies to remember when dealing with the WPF metadata writer:</p>
<p>1. Make sure that your method that deals with the metadata is invoked on an STA apartment thread. Otherwise, you get some nasty COM exceptions. You can check if your method is running on STA by using the Thread.CurrentThread.GetApartmentState() call.</p>
<p>2. If you find that the file is getting smaller after writing metadata, just make sure that your Encoder compression setting is &#8220;None&#8221;. (See my previous comment).</p>
<p>3. If you find it hard to read an image file and write metadata to it, do it the simple way. Create a temporary file that is a copy of the original image. Load the image decoder using the temporary file and after filling in the metadata, write the encoder output to the original file. Then, you can delete the temporary file.</p>
<p>Hope this helps !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Eichacker</title>
		<link>http://blog.andreweichacker.com/2009/02/reading-and-writing-tags-for-photos-in-wpf/comment-page-1/#comment-4691</link>
		<dc:creator>Andrew Eichacker</dc:creator>
		<pubDate>Wed, 25 Aug 2010 18:49:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.andreweichacker.com/?p=128#comment-4691</guid>
		<description>Thanks, Koshy.  I&#039;m sure that&#039;ll prove helpful to anyone supporting .tiff files in the future.</description>
		<content:encoded><![CDATA[<p>Thanks, Koshy.  I&#8217;m sure that&#8217;ll prove helpful to anyone supporting .tiff files in the future.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Koshy</title>
		<link>http://blog.andreweichacker.com/2009/02/reading-and-writing-tags-for-photos-in-wpf/comment-page-1/#comment-4690</link>
		<dc:creator>Koshy</dc:creator>
		<pubDate>Wed, 25 Aug 2010 18:11:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.andreweichacker.com/?p=128#comment-4690</guid>
		<description>Wow !!! I finally got this thing to work....thanks to Andrew and all the previous commenters.

To all the guys above who found that the file size got smaller, I found the solution....

Just set the encoder compression to None.....for example, in my case I was using TiffBitmapEncoder.

All I had to do was set TiffCompressOption.None as the setting. That fixed it !!</description>
		<content:encoded><![CDATA[<p>Wow !!! I finally got this thing to work&#8230;.thanks to Andrew and all the previous commenters.</p>
<p>To all the guys above who found that the file size got smaller, I found the solution&#8230;.</p>
<p>Just set the encoder compression to None&#8230;..for example, in my case I was using TiffBitmapEncoder.</p>
<p>All I had to do was set TiffCompressOption.None as the setting. That fixed it !!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Koshy</title>
		<link>http://blog.andreweichacker.com/2009/02/reading-and-writing-tags-for-photos-in-wpf/comment-page-1/#comment-4670</link>
		<dc:creator>Koshy</dc:creator>
		<pubDate>Tue, 24 Aug 2010 01:30:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.andreweichacker.com/?p=128#comment-4670</guid>
		<description>Hi Andrew,

Great article and really nice code...but does this work for .tiff format as well ? I tried the code on a 16 bit .tiff file and at the code where the output file is saved, I got an Overflow Exception. 

I wonder if this has something to do with the padding value or is it the tiff format. 

metadata.SetQuery(&quot;/app1/ifd/PaddingSchema:Padding&quot;, paddingAmount);
metadata.SetQuery(&quot;/app1/ifd/exif/PaddingSchema:Padding&quot;, paddingAmount);
metadata.SetQuery(&quot;/xmp/PaddingSchema:Padding&quot;, paddingAmount);

Can I use the above code for .tiff format as well ?</description>
		<content:encoded><![CDATA[<p>Hi Andrew,</p>
<p>Great article and really nice code&#8230;but does this work for .tiff format as well ? I tried the code on a 16 bit .tiff file and at the code where the output file is saved, I got an Overflow Exception. </p>
<p>I wonder if this has something to do with the padding value or is it the tiff format. </p>
<p>metadata.SetQuery(&#8220;/app1/ifd/PaddingSchema:Padding&#8221;, paddingAmount);<br />
metadata.SetQuery(&#8220;/app1/ifd/exif/PaddingSchema:Padding&#8221;, paddingAmount);<br />
metadata.SetQuery(&#8220;/xmp/PaddingSchema:Padding&#8221;, paddingAmount);</p>
<p>Can I use the above code for .tiff format as well ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dealing with Images with Bad Metadata &#8211; Corrupted Color Profiles in WPF &#124; Programming</title>
		<link>http://blog.andreweichacker.com/2009/02/reading-and-writing-tags-for-photos-in-wpf/comment-page-1/#comment-4651</link>
		<dc:creator>Dealing with Images with Bad Metadata &#8211; Corrupted Color Profiles in WPF &#124; Programming</dc:creator>
		<pubDate>Sun, 22 Aug 2010 01:23:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.andreweichacker.com/?p=128#comment-4651</guid>
		<description>[...] by adding the BitmapCreateOptions.IgnoreColorProfile flag to CreateOptions.     As an aside, Andrew Eichacker has a nice post on how to read all the BitmapMetadata in WPF. There&#8217;s lots in [...]</description>
		<content:encoded><![CDATA[<p>[...] by adding the BitmapCreateOptions.IgnoreColorProfile flag to CreateOptions.     As an aside, Andrew Eichacker has a nice post on how to read all the BitmapMetadata in WPF. There&#8217;s lots in [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Hanselman - Dealing with Images with Bad Metadata - Corrupted Color Profiles in WPF</title>
		<link>http://blog.andreweichacker.com/2009/02/reading-and-writing-tags-for-photos-in-wpf/comment-page-1/#comment-4350</link>
		<dc:creator>Scott Hanselman - Dealing with Images with Bad Metadata - Corrupted Color Profiles in WPF</dc:creator>
		<pubDate>Fri, 30 Jul 2010 23:03:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.andreweichacker.com/?p=128#comment-4350</guid>
		<description>[...] an aside, Andrew Eichacker has a nice post on how to read all the BitmapMetadata in WPF. There&#039;s lots in [...]</description>
		<content:encoded><![CDATA[<p>[...] an aside, Andrew Eichacker has a nice post on how to read all the BitmapMetadata in WPF. There&#039;s lots in [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Eichacker</title>
		<link>http://blog.andreweichacker.com/2009/02/reading-and-writing-tags-for-photos-in-wpf/comment-page-1/#comment-2663</link>
		<dc:creator>Andrew Eichacker</dc:creator>
		<pubDate>Tue, 05 Jan 2010 17:52:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.andreweichacker.com/?p=128#comment-2663</guid>
		<description>Sounds like the outputFile is currently in use, or the location is not accessible to the current user.

The outputFile might still be in use from this application, as the stream you opened for it earlier might not quite be closed.  If that&#039;s the case, you could go the route that I suggested above for urza, where you save a temporary file and copy it over.  Alternatively, you could create a loop that waits for the file to be accessible, but be sure to have a cap for that in case it never becomes accessible.

If it is a permissions problem, you&#039;ll have to require that your application be ran with administrator privileges, or notify the user that the file they are trying to modify is not accessible by them (I&#039;d go with the latter).</description>
		<content:encoded><![CDATA[<p>Sounds like the outputFile is currently in use, or the location is not accessible to the current user.</p>
<p>The outputFile might still be in use from this application, as the stream you opened for it earlier might not quite be closed.  If that&#8217;s the case, you could go the route that I suggested above for urza, where you save a temporary file and copy it over.  Alternatively, you could create a loop that waits for the file to be accessible, but be sure to have a cap for that in case it never becomes accessible.</p>
<p>If it is a permissions problem, you&#8217;ll have to require that your application be ran with administrator privileges, or notify the user that the file they are trying to modify is not accessible by them (I&#8217;d go with the latter).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://blog.andreweichacker.com/2009/02/reading-and-writing-tags-for-photos-in-wpf/comment-page-1/#comment-2661</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Tue, 05 Jan 2010 04:20:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.andreweichacker.com/?p=128#comment-2661</guid>
		<description>// finally, save the new file over the old file
        using (Stream outputFile = File.Open(filename, FileMode.Create, FileAccess.Write))
        {
            output.Save(outputFile);
        }


On the line output.Save(outputFile);
I&#039;m getting the error &#039;Access is Denied&#039;

Any idea what this means?</description>
		<content:encoded><![CDATA[<p>// finally, save the new file over the old file<br />
        using (Stream outputFile = File.Open(filename, FileMode.Create, FileAccess.Write))<br />
        {<br />
            output.Save(outputFile);<br />
        }</p>
<p>On the line output.Save(outputFile);<br />
I&#8217;m getting the error &#8216;Access is Denied&#8217;</p>
<p>Any idea what this means?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Vincent</title>
		<link>http://blog.andreweichacker.com/2009/02/reading-and-writing-tags-for-photos-in-wpf/comment-page-1/#comment-2518</link>
		<dc:creator>Ben Vincent</dc:creator>
		<pubDate>Sun, 06 Dec 2009 03:13:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.andreweichacker.com/?p=128#comment-2518</guid>
		<description>Interesting thread, I didn&#039;t appreciate another consequence of the Onload vs OnDemand. I&#039;ve published a pretty comprehensive metadata library on Codeplex if anyone is interested (http://fotofly.codeplex.com/).</description>
		<content:encoded><![CDATA[<p>Interesting thread, I didn&#8217;t appreciate another consequence of the Onload vs OnDemand. I&#8217;ve published a pretty comprehensive metadata library on Codeplex if anyone is interested (<a href="http://fotofly.codeplex.com/" rel="nofollow">http://fotofly.codeplex.com/</a>).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

