Fixing the Ability to edit iPhone Images Imported to Windows

If you’ve been plagued by the following errors ever since upgrading to iOS5:

This photo can't be saved because of a problem with the photo's file properties.
This photo can’t be saved because of a problem with the photo’s file properties.
Photo Gallery couldn't update this file: Error code: (0x80070057)
Photo Gallery couldn’t update this file: Error code: (0x80070057)

Fret no more, relief is here!

After much investigation the root cause is erroneous white-space characters in the XMP block of the image files. 

The first step to fixing this problem is to

Stop taking pictures with the volume button!

No, this is not a solution but the problem seems to happen more frequently for images taken with the volume up button than images take win the shutter release on-screen button. Therefor, avoiding the volume button seems like a good idea. Next,

Fix the Images which already have the issue!

Lots of work-arounds have been posted for when you discover the problem when editing a particular image, however; the issue may surface down the road on images you have not previously edited. For me, fixing the issue only on the images I attempted to edit was not a good solution. I wanted an all-or-nothing fix.

I’ve written a small Java utility which will scan over an entire directory (or a directory of directories, or a directory of directories of directories, etc) and fix the issue on any images which have it.  The full source code is available on Google Code (yes I still live in 2009, but at least it’s using mercurial). It will not touch images which do not have the issue.

Download jpegxmpxmltrimmer

As of this post the current version is 0.01 which essentially means:

It’s pre-production, pre-release, pre-beta, pre-alpha, pre-warranty, you-get-what-you-pay-for. /disclaimer

Run jpegxmpxmltrimmer

Assuming you already have a Java JRE installed, bring up a command prompt and enter the following command:

NOTE: This command will not edit existing files.  This is the safe mechanism to fixing your images.  Rather than fixing the originals, it makes copies and fixes the copies (named appropriately).

java -jar <path-to-downloaded-jpegxmpxmltrimmer.jar> <path-to-root-directory-of-images>

If you would like to fix the error by editing the existing files simply add a true at the end of the commandline.

That’s it.  You’ve now fixed the issue!  Yay! <insert-mini-celebration-here/>

The Catch

You’ve fixed the images with the pre-existing issue, but the bug still exists in the latest release of iOS (5.1 as of this post).

For now, you’ll have to run the utility over any files you import.  I’ve still found the issue on a few photos I’ve imported even since I stopped using the volume button.

I’ve reported the issue to Apple but haven’t yet heard back.  If you want this issue fixed permanently I suggest you do the same:

WebCam Tracker v0.9.0

For whatever reason I wanted to spend a little more time on my WebCam Tracker program by throwing a UI on top of it.  I did and it turned out reasonably well for my first foray into SWT.

3 things I would still like to do:

  1. Thread the image retrieval process.  It’s done but something happens with the output streams on the new thread which causes it to hang when System.out is called.  If I figure that out it’ll be easy to re-implement.
  2. Implement the progress bar at the bottom of the window.  It should be able to track the progress based upon the provided duration easily enough.
  3. Come up with a better widget for picking the duration and delay times.

Since I took a little bit of extra time to glossy it up a bit, there’s no sense in making it go to waste.  I threw the code & the distribution up on Google Code.  You can see it at WebCam Tracker.

Another time-lapse I did using WebCam Tracker.  Kinda neat.

Sunset over Lake McDonald

Let me know what you think, and of course I welcome any comments/feedback about the app.  Not that I’ll necessarily do anything about them… I don’t plan on spending much time on it… but I’d like to know.

Hawaiian Tsunami Timelapse

I heard about the possible Tsunami hitting Hawaii on Saturday about an hour before the predicted time.  As any photographically inclined programmer would do I went searching for some WebCams.  Once I found some that were returning images (most were timing out or saying too many users) I decided it would be neat if I could capture the images over time and throw them together into a video later.

About 15 minutes later and  WebCamTracker was born.  It’s nothing fancy, just a small Java class that’ll pull down a single image or multiple from the specified URL. To run it just use:

java WebCamTracker <webcam URL> <output directory> <?Max Duration?> <?Delay?>

Fortunately (but unfortunately for the video) the Tsunami didn’t really amount to much in Hawaii.  The video does however show the surges so it’s still pretty neat.  I ran WebCamTracker on 3 WebCams: Kanaha, Sprecks, & Hilo Bay. They turned out pretty sweet even if they don’t show much wave action.  Pretty good for my first time-lapse, even if I didn’t actually take the pictures myself.  Something I might play with soon though…

Anyway, Check it out:

side note: Music by JukeBox the Ghost, one of my favorite bands.

WebCamTracker.java

It's the Variable Noob!

I’ve seen a lot of crazy code in the past few years but this one takes the cake. The project I was working several years ago was developed while the developers at my company switched to Java. I’m not sure if that excuses the following or not but it’s at least an attempt.

return (test == true) ? ((test != false) ? true : false) : ((test == false) ? false : true);

Just for the record this whole line equates to:

return test;

Hopefully the compiler is good enough to figure that out but even so it’s a lot of ridiculous confusing code to accomplish something pretty basic and fundamental to any language. The sad part is this line of code wasn’t just found in one place, I found it literally everywhere a boolean value was returned.

I wonder what I’ll find in a few years when I look back at code I wrote?

Never hire a colorblind electrician

What’s your fortune? apparently I’m supposed to ignore mine whatever that’s supposed to mean. We went to Yangzee (or Wild Bar and Grill) for lunch today. As is typical we got fortune cookies afterward. Mine read “Ignore Previous Cookie“. Strangest. Fortune Cookie. Ever.

Mr Coffee E-mailThis morning the coffee machine overflowed. I didn’t think much about it until I got the E-mail from Mr Coffee. Take a read. I didn’t know Mr Coffee ran java.

Read an interesting article about Windows Vista’s ReadyBoost. Pretty interesting. Also now that Windows Vista includes the ability to use Flash memory as a Cache there is talk about including built in Flash memory with new computers.

if you’re interested to see what is truth and what is fiction in 300 check out this article.