﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>The Renegade Blog</title>
    <description>Music, chaos, order, programming, web sites, politics, anarchy, drugs, and other random thoughts. What did you expect from the Renegade Mind?</description>
    <link>http://renegademinds.com/Home/Blog/tabid/60/BlogId/1/Default.aspx</link>
    <language>en-US</language>
    <managingEditor>delete.this.ryan@renegademinds.deletethistoo.com</managingEditor>
    <webMaster>ryan@renegademinds.com</webMaster>
    <pubDate>Sat, 04 Feb 2012 01:28:01 GMT</pubDate>
    <lastBuildDate>Sat, 04 Feb 2012 01:28:01 GMT</lastBuildDate>
    <docs>http://backend.userland.com/rss</docs>
    <generator>Blog RSS Generator Version 3.4.0.39853</generator>
    <item>
      <title>C# Image Orientation Gotcha</title>
      <description>&lt;p&gt;Well, I've been having some mysterious problems finding out image orientations as they simply seem to disappear.&lt;/p&gt;
&lt;p&gt;Image orientation is contained in EXIF meta data and can be gotten through the Image.PropertyItems property of an Image.&lt;/p&gt;
&lt;p&gt;However, when dealing with an image, Windows places a lock on the file, making things rather inconvenient. As such, you need to clone or copy the image then dispose of the Image something like this:&lt;/p&gt;
&lt;p&gt;img.Dispose();&lt;br /&gt;
img = null;&lt;/p&gt;
&lt;p&gt;For slower computers or limited memory you'd also want to do garbage collection with GC.Collect().&lt;/p&gt;
&lt;p&gt;However, once you do that, the image orientation EXIF information is no longer available. It just disappears.&lt;/p&gt;
&lt;p&gt;So, to get the orientation you must leave the file locked, get the information like this:&lt;/p&gt;
&lt;p&gt;PropertyItem propItem = image.GetPropertyItem(274);&lt;br /&gt;
ushort orientation = propItem.Value;&lt;/p&gt;
&lt;p&gt;In any event, I hope that helps someone out. It's not intuitive and it's just one of those PITA gotchas that you need to know.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description>
      <link>http://renegademinds.com/Home/Blog/tabid/60/EntryID/217/Default.aspx</link>
      <author>delete.this.ryan@renegademinds.and.delete.this.com</author>
      <comments>http://renegademinds.com/Home/Blog/tabid/60/EntryID/217/Default.aspx#Comments</comments>
      <guid isPermaLink="true">http://renegademinds.com/Default.aspx?tabid=60&amp;EntryID=217</guid>
      <pubDate>Fri, 24 Dec 2010 14:37:00 GMT</pubDate>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://renegademinds.com/DesktopModules/Blog/Trackback.aspx?id=217</trackback:ping>
    </item>
  </channel>
</rss>
