NET objects after use, and therefore unlock the files again.įor the extra points of this event, I added the Folder browsers, checking for the modules, and loading them when available at the start of the script. ::FromFile(‘C:\powershell\SG2011\SHARE_P1000500.JPG’) | gmĪs you can see in the previous code, one time the file is opened by using a COM object and the other time by using. I later found out that I could remove the properties as easy as this, but I somehow completely overlooked the Remove method then. I found some examples in C# to remove the binary data, but that looked a bit too “Brute Force.”
#Photo resixer with exif data how to#
Although I could set the simple text properties, I could not find out how to do what I wanted and remove all properties. I spent a lot of time figuring out a way to do this by using the. Even in the newer imaging library, I could not find a good way to do this. Then came the hard part…finding out how to remove ALL the EXIF data. In a couple of minutes, I came up with the interface shown in the following image. It is not a fancy interface but, but I wanted to show that by using StackPanels and grids, you can easily build a basic interface, even in code, as long it you do not need it to be fancy. I added some grid rows for the extra directory pickers, and an extra vertical grid to add the RTF box for the properties. There were no big problems in doing that. I tweaked the interface a bit to add the controls I needed. Path : C:\Users\morsouw\Pictures\ww-xmasparty2010\P1000501.JPGĪfter I got this output, I spent a lot of time searching, but it still saved me a lot of work to get decent information for the properties window, and I was ready to work on the interface part. The use of this function is illustrated here. It gives a much nicer list of properties, and it also did the GPS coordinates conversion-the work I did not want to do again myself. With further research aimed at a more complete solution, I found the information I was looking for-again on James’ blog, and there seemed to be a newer version of the image module available on MSDN.Īfter downloading and installing the module, I found Get-Exifdata, which did what I needed. The byte arrays are converted, but a lot of data is still not in a readable format, and it needs more conversion to be usable. The problem is not getting the values, but rather because they are byte arrays, converting the values to usable data.Īnd the Get-ImagePropery function only got me part of the way. The Get-ImageProperty function was a bit too basic, and it did not do the job for me. However, when I got started, I missed some of the functionality that I needed and expected in the library from James. I was making a dependency on the PowerShellPack anyway, so I figured I could use WPK as well for the interface part, knowing that I could “steal” the basic interface from an article by Doug Finke. I knew that James’s library was included in the PowerShellPack module, and I decided to use that module in my solution after all. But whilst searching for info, I was reminded of the fact that a lot of refactoring has to be done to extract the interesting data, because a lot of properties need their own custom conversion (a good example is the GPS information that I really wanted to have in). I knew it was possible to get the EXIF data by using. When I started looking at Advanced Event 8, my first thought was to use no external dependencies. This is not a production ready script, it just does enough to fulfill the requirements, but with some work, I think it would make a cool and handy tool and a good addition to the Imaging library.
#Photo resixer with exif data windows#
He is from the Netherlands, but he has been living in Switzerland for two years, and he is working as a technical consultant at WinWorkers Schweiz GmbH, mostly in the Microsoft System Center area…and of course, he is using automation and Windows PowerShell wherever feasible. He was among the very early adapters of Windows PowerShell, has lots of hands-on experience, has spoken about Windows PowerShell at diverse events, and he is running the PowerShell Script Club in Zurich for the Swiss IT user group. He is best known for his blog, and for his utilities for Windows PowerShell, such as PowerTab and the PowerShell WMI explorer. Marc has been a Windows PowerShell MVP for the last six years. Marc van Orsouw (MoW) is our expert commentator for Advanced Event 8. Microsoft Scripting Guy, Ed Wilson, here. Summary: Microsoft PowerShell MVP, Marc van Orsouw, resizes images and removes EXIF metadata while solving 2011 Scripting Games Advanced Event 8.