I recently got my first decent digital camera. The first one that had changeable lenses, a manual zoom, and full control over all the settings you could want. It takes some great photos, and to ensure that there are great photos, I take a lot of them. Quality through quantity.
The reason why I got this camera is because my partner and I eventually got around to travelling, and wanted to capture what we saw as best we could. Between us, we have taken approximately two thousand photos in just under three weeks. Many of these aren't great photos, and a few are downright awful, but some are brilliant. It's these brilliant ones that we want to share with our families and friends.
I use Ubuntu as my main operating system, which comes pre-installed with Shotwell Photo Manager. It's a product that has it's quirks, but it ultimately does everything I want it to. It allows me to import photos from the camera, organize them, tag them, and allows my partner and I to flag the best ones.
My next concern was to find some gallery software that would easily let us share our photos with others. I didn't want to be uploading large numbers of photos to facebook for various reasons, and I wasn't keen on depositing all of my photos into any other third-party service, either. I like to maintain at least a little bit of control. I thought it would be ideal if I could find something that would allow me to upload directly from Shotwell, as that would mean the least amount of messing around possible.
I found that software in Piwigo, which very handily is able to be installed from the control panel of my web host. Piwigo has some throw-backs from the early days of Open Source CMS development, but still functions fine, even if it is a little clunky in places. It supports themes and plugins, although the community isn't huge, and generally seems stable.
The only problem I had now was that the images averaged at 8MB each, with some getting up to 11MB. Even if that was too large for the PHP post_max_size setting (it was), I wouldn't want to be uploading that amount of data while travelling. In Shotwell, you can easily duplicate images, modify the duplicate, and leave the original intact, which is important for us if we ever want to create large prints in the future. That was fine, but as soon as I had more than 20 images to process, I realized that I had to find a way to automate it.
My first solution was to write a simple PHP script to find the duplicated photos (conveniently named with a trailing "_1.JPG"), and use the GD library to re-size them. That worked OK, except that the GD library won't write EXIF data back to the file, and that data is required when it is telling the reader that the photo has been rotated. I made modifications to the script to rotate images, and to read in, update, and re-write EXIF data to photos, but I was losing pieces of metadata, and the rotation destroyed the image quality. Clearly I needed something better.
After some discussion with friends, I came across exiftran, which will read EXIF data, rotate the image if required, and re-write the updated data automatically. It's very simple, and you can pull it down with apt:
sudo apt-get install exiftran
Using find, I was able to search for all of the duplicate photos that I had made today, and apply the filter:
find -type f -ctime 0 -name *_1.JPG -exec exiftran -ai {} +
The next step was to re-size the images, so that they would be easier to upload. I found that bringing them down to 25% of the original still resulted in nice, viewable images which usually came in at under 1MB each. Perfect.
Using imagemagick (install-able through apt, and quite likely installed by default), this is easy to accomplish:
find -type f -ctime 0 -name *_1.JPG -exec convert -resize "25%" '{}' '{}' \;
It took a while, but it was done. All of the images processed, rotated, and all EXIF data preserved. Shotwell let me upload straight to Piwigo, and my originals remain unharmed.
The only other thing to note is that the user in Piwigo must be set as a "webmaster", or the upload will fail. I spent a fair amount of time trying to figure out why I kept receiving a 401 message when trying to upload to my partner's account, when she was set to "administrator". This seems to be an odd limitation from the Piwigo extension that Shotwell leverages to publish photos.
Comments
Hi Sam, I'm glad that you're
Hi Sam, I'm glad that you're fine and enjoying your travel :)
In regard to image resizing - I'm finding that digiKam has way more knobs and dials than any of its Gnome conterparts (f-spot and shotwell). In fact, it's true for any KDE program compared to a similar Gnome program. KDE has a whole framework of image-processing plugins called kipi, so the plugins can be reused across many KDE applications.
I'm managing my 40+K of photos using f-spot (because shotwell was way too dumbed down even compared to f-spot the last time I checked). When I want to send some photos to my relatives, I ctrl-click the good ones in f-spot (because you only want to select the good ones) and drag them into a separate folder (because you want to keep the originals unmodified)
Then I open that other folder in digiKam and batch resize the pics. After the resizing I usually just email a zip file to somebody. The resized pics can be deleted after that - you don't want to add them to your "image repository" or anything.
f-spot, digiKam and supposedly shotwell also have plugins for uploading pics to flickr, picasaWeb etc. - those has their own settings which allow you to auto-resize the images when uploading. I'm not sure which one you use to upload to Piwigo.
Post new comment