Archive for January, 2008
One of the great things I really like about the iPod touch is that it makes an excellent portable viewer for photos. In return for sacrificing 1GB of potential music storage, I get about 2,000 browseable, zoomable photos onto something that’s always in my pocket. Cool!
To make the process easier, here’s a python script to synchronise the photos on an ipod from a flickr account. It’s at http://www.stdlib.net/~colmmacc/flickrtouchr.py.txt. It should run on any *nix platform (personally I’m running it on a Mac) and there’s some kind of a chance it might even work on Windows (but who knows).
The whole thing is a single python file, as implementing the flickr API calls myself rather than use any of various python flickr libraries (as they each seem poorly maintained) seemed easier. One of the reasons I’m even putting it online is that beyond anything else, it may be useful as an example of a truly minimal python implementation with the flickr API.
You run the script like so;
and after it asks you to authenticate against your flickr account, it will progress through syncing your entire flickr account into a directory hierarchy. It keeps a small cache of authentication data in the directory too. It will be organised like;
directory-name/set-name/[photos] directory-name/other-set-name/[photos] directory-name/No Set/[photos] directory-name/Favourites/[photos]
If you have the same photo in multiple sets it will use hard-links to preserve local disk-space. It also only downloads the most optimal version of the photograph available for the iPod touch/iPhone screen. Everytime you run it, it downloads the missing photos and new sets. Once you configure iTunes to synchronise photos from a folder, rather than iPhoto, it works great.
Of course it will work with any other device or software that takes photo from a hierarchy of folders. Happy flickring.
Since launching the new photoblog over at all costs I’ve gotten a few questions about how to overlay a signature, and how I’m doing it.
I’m a command line type of person so much of the processing software for my photos is python scripts I’ve hacked together, but in this case it’s just some simple ImageMagick which you can do almost anywhere. ImageMagick is much better than using Python’s own Image Library (PIL) because it actually maintains the embedded colourspaces (PIL just strips them).
Step 1: Create the image
The first step is to actually write out the signature, and to take a photograph of it or scan it. I recommend writing it out as big as you can, with a thick marker, on white paper. If you’re taking a photo of it, try to light the paper evenly and take the photograph from directly atop the paper. Once you’ve got an image to start with, load it into the Gimp.
Step 2: Crop the image
Select what you want with rectangle select tool, and crop, using image -> crop to selection.
Step 3: Convert to 1-bit
We don’t want to worry about all of the various shades that are in the image, so we convert to a 1-bit image. Use Image -> Mode -> Indexed to convert.
Step 4: Convert to grayscale
Now that we’ve cheated and used 1-bit mode to quickly go black-and-white, we need to go back to greyscale mode so that we can use transparency and play with the brightness a little. it’s at Image -> Mode -> Greyscale.
Step 5: Invert the colours
Use Colors -> Invert to transform the image into white on black, which is much better for overlaying onto photographs generally.
Step 6: Add an alpha channel
Since we need the final result to contain transparency, we need to add an alpha channel. It’s at Layer -> Transparency -> Add Alpha Channel.
Step 7: Remove the background
Use the colour-select tool at Select -> by Color to highlight all of the black background, and then cut it out using ctrl-x (or edit -> cut).
Step 8: Tweak the signature image
Personally I found that using a pure white signature was too strong and distracting, so I lowered the brightness by about 30%.
Once you’re happy with the image, you need to have it as a PNG file, so that we keep the transparency information.
Step 9: Applying the signature to photos
ImageMagick makes this fairly easy, all that I use is:
convert -composite -gravity southeast original.jpg signature.png output.jpg
Where photo.jpg is the original jpg of the photograph, and output.jpg is where you want the result.