Posts Tagged ‘PhotoFile’

(on Technorati , Del.icio.us)

PhotoFile

Screenshot update! Still no version… as it’s still just a husk of a UI… mostly.

PhotoFile pre versioning

I’ve changed the GUI quite a bit. Actually, what it is now took a surprisingly long time to arrive at. I spent time going through some ideas on paper, and I even did a huge amount of refactoring to make coding easier. It’s at the point where a GUI in another API could easily be thrown in…. it just requires me separating the PhotoFile class into PhotoFile and PhotoFileGTK… but I’m not going to bother, at this point, because I don’t think there’s much point in offering it in another kit. GUI and no-GUI could be useful, though. Anyway, there’s still quite a few problems remaining, including:

  1. Supported File Types: I need a list of file types (extensions) that are common in Cameras and that people would be interested in transferring. So far, I’ve got what my camera supports: JPG, THM, AVI, and WAV. Some cameras allow for sound recordings to be created (WAVs on mine) but I’m not sure what I should do with these… rename to have the same name as the image, I guess (if it’s a memo). Post your camera’s formats and how they’re used in the comments! Example of my Camera: WAV files with a filename the same as an image are a sound memo for that image. AVIs are movies and have and accompanying THM file (same filename) which is a small Jpeg containing a thumbnail of the movie.
  2. Empty Source Directories: When moving files from the source, should I automatically remove any empty source directories? Maybe add an advanced property for this? I certainly don’t want to add it to the main dialog. KISS.
  3. Separate Operations: I’m not sure if each file should save it’s own set of operations for the session. For example, user selects manual rotation for two files, and auto-rotation for the rest. Should Process All Files remember those two files’ manual rotation, or should it apply the visible operations to ALL files. If I should save settings for each file, then I feel like I’d need another button, Process All Files Using These Operations, just to be clear… maybe a “Reset to defaults” somewhere… sounds like too much clutter, but it could be useful for people whose camera’s don’t store EXIF. Suggestions?
  4. Manual Rotation: Need a dropdown or something for Manual rotation! Probably: {Left, Right, 180} or… a button Rotate 90 CW that when clicking, rotates the preview 90 degrees, clockwise. I kind of like that idea… super simple. To rotate “left”, the user would quickly learn that 3 quick clicks is quite fast.
  5. White Space: I think I need a little more white-space between the different sections.
  6. Functionality!
  7. Camera’s dying? Oh noes! I love my Canon IXY 400, but I’ve recently been getting a very ominous Memory Card Error message, more frequently. It worries me.

Aside from these things, I think I’m pretty satisfied with the current UI.

Still a tiny app, and still lots of things to do! 😀


$ cat photofile.py | wc -l
792
$ cat photofile.py | grep FIXME | wc -l
25

EXIF.py and Image Orientation

I was really puzzled… and in fact, I’m still puzzled, but at least it works now.

Update: I’m a bit less puzzled now. I wasn’t using the correct version of EXIF.py (see comments). This post has been updated to correct any information. I also updated the CODE style because posting python code when whitespace is ignored is a little confusing. ^.^

I’m now using EXIF.py for loading EXIF information from photos for my little project, PhotoFile. Today, I wanted the image orientation information. Looking in the source of EXIF.py, you’ll find:


EXIF_TAGS={
...
0x0112: ('Orientation',
{1: 'Horizontal (normal)',
2: 'Mirrored horizontal',
3: 'Rotated 180',
4: 'Mirrored vertical',
5: 'Mirrored horizontal then rotated 90 CCW',
6: 'Rotated 90 CW',
7: 'Mirrored horizontal then rotated 90 CW',
8: 'Rotated 90 CCW'}),
...
0x9003: ('DateTimeOriginal', ),
...
}

So, I tried:


image = open("photo.jpg", "rb")
tags = EXIF.process_file(image)

Using tags["DateTimeOriginal"] works fine. But using tags["Orientation"] does not work. So finally (it took an unfortunate amount of time to do this), I tried:


for tag in tags.keys():
if "orientation" in str(tag).lower(): print tag

To correct the above, I’m a little lazy with composition, so it’s easier to just post some output from a python session:


>$ python
>>> import EXIF
>>> p = open("photo.jpg", "rb")
>>> tags = EXIF.process_file(p)
>>> for key in tags.keys():
... if "orientation" in str(key).lower() or \
... "datetime" in str(key).lower(): print key, ": ", tags[key]
...
EXIF DateTimeOriginal : 2006:03:19 14:22:40
Image DateTime : 2006:03:19 14:22:40
EXIF DateTimeDigitized : 2006:03:19 14:22:40
Image Orientation : Rotated 90 CCW

There is indeed no “Orientation” tag but there is an “Image Orientation” tag. The string “Image Orientation” appears nowhere in the source, and I couldn’t find any documentation on it. It looks like the tag keys are set by reading them from the EXIF information within the file appending the key to the classification (as pointed out by Shirley – see comments), but even the EXIF spec lists the tag as “Orientation”. If anybody knows why this is the case wants to clarify further, please post in the comments.

Conclusion

So if you’re using EXIF.py and want access to the image’s orientation, use “Image Orientation” for the key.

touch PhotoFile

So I’m going with the name PhotoFile for my new project. Clever, I know. Actually, not sure what exists out there already, like this or with a similar name. A quick google search didn’t reveal much. Either way, I’m sure nothing exists that is quite so perfect for ME (I’m incredibly selfish), and I think this will be a good learning experience, so I plan on getting it to a reasonably usable state, at least.

PhotoFile - so early it doesn’t have version numbers yet!

I liked the original left-to-rightness, as it visually led the user through the workflow; and that’s how I originally envisioned it. But the whole thing was getting too wide. So I’ve updated the GUI a bit (not final by any means) and I think this is looking better, for now. Open to ideas/suggestions, of course.

Since last upate, I’ve done some (much needed) code refactoring and cleaning up, added minimal Exif support using EXIF.py, and some GUI modifications (file list frame is resizable, added the filename below the thumbnails, moved the Original thumb above the Preview thumb). Most of it is still just GUI stuff and it’s not functional, but it’s getting to a point where I will easily be able to make a few things functional.


$ cat photofile.py | wc -l
470
$ cat photofile.py | grep FIXME | wc -l
24

It’s still just a wee little program. 🙂

Project()

I’m currently working on an idea I’ve been kicking around for a long time:

photofile 0.0000001

This is being done in Python and PyGTK. It’s mostly just GUI stuff at the moment (none of the operations are functional), as I’m learning GTK as I go. And even though I’ve done a bit of reading regarding Python, it’s gonna be my first real attempt with the language. Bottom line: progress will probably be slow. 😛

Some big news for Open Source, recently.

Also, apparently I’m strange, because I like the new Nano.

Now, that I’ve got rid of a bunch of bloggy things, I’m gonna go outside and rollerblade for a bit on this awesome day. Will grab a drink and poke at my new project after a soon-to-be-required shower.