Simple Photo Binder: easy photo management tool for newbies

Copyright (C) 2012 FAL Labs
Last Update: Mon, 12 Nov 2012 20:54:44 +0900


Simple Photo Binder is a system to manage photo albums on your server. It completely automates a series of operations to make your photos viewable through Internet.

When you upload photos, they are assorted according to date and you can take a look at them with web browsers. You can complete every operation of registering, editing, managing, and publishing your pictures with a web browser.

In 2012, a new type of storage media which supports data transmission through Wi-fi is prevailing, such as Eye-fi and FlashAir. Digital cameras with Wi-fi functionality are also selling. They upload photo data to somewhere on network as soon as you shoot photos. If you specify a spool directory of this system as the destination, your photos will be registered and managed by this system automatically.

Registered photo data is stored as-is on the server. At the same time, smaller images are generated to make it easy to show photos on displays. The most important feature of this system is that the viewing image is corrected cleverly and automatically. Because photos taken by automatic modes of digital cameras tend to have problems on exposure, such automatic correction is very useful. Even if you don't like tuning parameters determined automatically, you can reset or calibrate them by yourself.

The second important feature of this system is easiness to manage photo data. Digital cameras reduce the cost of each shot and you will take many photos at various scenes. It leads to a handful of success photos in a huge amount of failure ones. That's why features to select success photos from failure ones is important. Thus, this system integrates the slide show feature with a marking feature. While you are looking over each photos, you can mark failure ones. Finally, you can delete them at once.

This system was also designed for mobile devices (smart phones and tablets). It allows you to manage photos while you are taking a rest after you take photos outside. This system is useful to share your photos to your friends on SNSes etc immediately.

Although this system handles JPEG images mainly, PNG, TIFF, GIF, BMP, and RAW formats of various manufacturers are also supported. Movies in MPEG-1 and MPEG-4 formats are also supported. Moreover, this system implements many features of popular photo sharing services, such as bulk downloading and publishing. If you already have your Web server, this system requires no additional cost.

This system was developed in order for me to live my photo life more easily and happily. Such newbies as me have problems setting proper configurations of cameras when shooting. Especially, children moves quickly and I don't have enough time to calibrate even exposure. So, I usually depends on automatic modes. However, automatic modes often lead to somewhat dark pictures. The auto correction feature is a strong countermeasure of such failures. In addition, I often make mistakes on focus setting and suffer from camera shake and motion blur. Because such failures cannot be corrected after shooting, I take many shots for each scene. The slide show make it easy to select the best one from many pictures for each scene. If you are like me, you will certainly take to this system.


Here is the demonstration site of this system. Because the sample data are initialized periodically, please feel free to upload your photos and delete existing photos.

I recommend you to try the slide show feature. Use the "actions" menu on the top right of the screen to select the operation. Other features is also available via the "actions" menu.

Hire is the demonstration site for auto image correction in this system. You see that too light photos become darker and that too dark photos become lighter, and that already well-tuned photos are hardly modified.


As prerequisites of installation of this system, you must have a UNIX-like operating system where a web server which supports CGI script. And, please install the following software. Basically, only Ruby and Imagemagick are required.

Download bindphoto (not ready yet). Add executable permission to it, and put it under "/usr/local/bin".

$ cp bindphoto /usr/local/bin/bindphoto
$ chmod 755 /usr/local/bin/bindphoto

Download viewphoto-cgi (not ready yet). Rename it as "viewphoto.cgi", add executable permission to it, and put it under a directory where CGI scripts are executable. Let's call the directory as the "CGI root directory" and assume it as "/home/mikio/public_html/photo" hereafter.

$ cp viewphoto-cgi /home/mikio/public_html/photo/viewphoto.cgi
$ chmod 755 viewphoto.cgi

Edit viewphoto.cgi to configure the password. Modify a line around the 70th where a variable "C_password" is defined. Set the value as a plain text of your password or you can set a small-case hexadecimal MD5 hash string trailing a prefix "MD5::". If you set nil as the value, the authentication feature will be disabled.

C_password = 'MD5::6df23dc03f9b54cc38a0fc1483df6e21'

By the way, you can generate MD5 strings easily by the following command. Replace "foobarbaz" with your password.

$ ruby -r digest/md5 -e 'print("MD5::#{Digest::MD5::new.update("foobarbaz").to_s}\n")'

Create three directories in the CGI root directory: "spool", "tmp", and "album". Add readable and writable permission for the user who execute the CGI script. Instead, you can assign the user as the owner of the three directory. In that case, you have to have the user run the cron command described below.

$ cd /home/mikio/public_html/photo
$ mkdir spool tmp album
$ chmod 777 spool tmp album

For security reasons, you had better disable "directory index" features of the web server, which shows a list of files in directories.

bindphoto is a program to watch the spool directory where photo files are uploaded. It is run periodically by the "cron" mechanism. Typically, you will set the following configuration by the "crontab" command. The first argument of the bindphoto is the absolute path of the CGI root directory.

*  *  *  *  *   /usr/local/bin/bindphoto /home/mikio/public_html/photo

Let's put a test photo in the spool directory (/home/mikio/public_html/photo/spool). It will be moved to the album directory within a minute.

Access viewphoto.cgi with a web browser. You will be asked the password so input the one you set. Then, you will see the thumbnail of the test photo in the screen.

If you use Eye-fi, please use the FTP uploading feature of the Eye-fi center. The destination should be the spool directory described above. Even if you use other media or uploader, set the spool as the destination of data transmission so that this system can accept your photos.

viewphoto.cgi is tested with Google Chrome 23 (Linux/Mac/Windows), Firefox 17 (Linux/Windows), Safari 6 (Mac), Internet Explorer 9 (Windows). It is also tested on the standard browsers of Android 4.2 and iOS6.


Basic Functionality

The password you asked when you accessed viewphoto.cgi for the first time is stored as a cookie by your browser, it is not asked again.

When you access viewphoto.cgi, you see a list of directories whose name is shooting date of photos, like the following. The column of each directory shows thumbnails of photos which it contains. If you click the directory name or the thumbnails, you will move into the directory and see the photos there.

In this listing screen, you see the file name, the thumbnail, the shooting configuration, and some operation icons for each photo. If you click the file name or the thumbnail, you will see the image of the photo.

To go back to an upper directory, click somewhere on the path near a directory icon around the top of the screen. The "/" on the left side of the path takes you to the root directory. In addition, if you push the "q" key on the keyboard, you will go to the direct parent directory. To jump to the previous sibling directory, use the "<<" link or push the up arrow key. To jump to the next sibling directory, use the ">>" link or push the down arrow key. To move to the previous page in the current directory, use the "<" link or push the left arrow key. To move to the next page in the current directory, use the ">" link or push the right arrow key.

Note that each photo has the following three kinds of images.

The viewing image is generated from the original image to reduce the data size adjusting the long side as 1500 pixels. It is enough size for almost all displays these days. If an original image is in JPEG format and has 20 mega pixels, its size is about 10MB while the size of the viewing image is about 600KB. Smaller the data size is the more confortably you can display and transmit the image. In addition, the image is corrected automatically so that most photos should look better.

If you click the camera icon, you will see the original image. If you click the "i" icon, you will see the shooting configuration.

In the root directory, photos are sorted in the descending (newer first) order of the shooting date. That's because you will see newer photos more often. In other directories, photos are sorted in the ascending (older first) order of the shooting date. If you want to change the order, select "sort ascending" or "sort descending" in the "actions" menu on the top right of the screen.

If you want to clear the authentication cookie, select "logout" in the "actions" menu.

Auto Correction of the Viewing Images

When the viewing image are made from the original image, the brightness is corrected automatically. It make each pixel lighter to the limit where no pixels become white-clipped so that the dynamic range is filled. If you take photos with auto exposure function of cameras, the images will frequently be darker than your expectation. This feature make such photos look better.

Moreover, gamma correction is applied in order for the average brightness to be appropriate. Dark photos will be a little blighter and blight photos will be a little darker so that each photo looks better.

If "enfuse" is installed, pseudo-HDR is enabled. It composes the original image and 3 over-exposed images and 3 under-exposed images into one image, which adopt best looking regions of all source data.

If the image was taken with a negative exposure bias setting, gamma correction is applied according to the strength of the bias. You will sometimes set a negative exposure value when highlight parts of the subject are loosing tone and colors. However, in that case, shadow parts tend to be too dark. This feature make such photos look better.

White balance, sharpness, and orientation might also be calibrated automatically. At large, these correction features alliviate your struggle when you shoot. Of course, auto correction is not a panacea and does not necessarily reflect author's intension and sometimes modifies images inappropriately. However, in most use cases by newbies like me, auto correction works pretty well.

Editing Functionality

If you are not satisfied with the result of automatic correction on the viewing image, you can re-create it by arbitrary settings you prefer. Clicks the gear icon in the listing screen to go to the editing screen.

When you push the "convert" button after you modify some settings, a new viewing image will be generated and shown. If you like it, push the "save" button. Note that the image is not saved until you push the "save" button.

If the viewing image is bigger than your display, an icon to view it in the equal scale is shown. After you convert the image, an icon to compare the viewing image and the original image at the same time is shown.

The more the quality of image data deteriorates, the more you modify it. However, the edit function of this system is non-destructive and re-creates the viewing image from the original image for each time. So, you don't have to worry about such decay accumulation. Moreover, you can get back to the initial state by selecting the "initialize" box anytime, you can fearlessly try various modification.

Managing Functionality

In the listing screen, each photo has a checkbox in the right top of its column. If you check it, the photo will be selected. After selecting one or more photos, you can operate them in bulk by selecting the operation in the "actions" menu.

If you move photos, the destination will be asked by a dialog. You can specify not only an existing directory but also a not-existing directory. In that case, the directory will be created. You can create a multi-layered hierarchy by using separators of "/", like "foo/bar/baz".

If you delete photos, they won't be actually deleted but moved to the trash directory. You can go to the trash directory by the "go to trash" operation in the "actions" menu. If you delete photos in the trash directory, they will be deleted completely. If you want to carry back photos to the original locations, use the "carry back" operation. If you want to delete all photos in the trash completely, use the "empty the trash" operation.

You can select all shown photos in the screen at once by using "select all" in the "actions" menu. "select none" and "select reversal" are also supported. Note that those operators do not necessarily handle all photos in a directory but handle all shown photos in the screen. So, if you want to do with all photos more than 50 in a directory, use the "show all" operation beforehand to show all photos in a directory. If you want to do with specific photos whose name includes a pattern, use the "search" operation.

You can change the name of a directory or photo via a dialogue which is shown by clicking the icon on the left of the name of each directory or photo. You can add a short comment to each photo.

Uploading Functionality

You can upload photos by web browsers by selecting the "upload" operation in the "actions" menu. Specify some files up to 5 in the shown dialog and then push the "upload" button. The uploaded files will be stored in the spool directory and registered asynchronously in about one minute.

You can choose the directory where the uploaded photos put, from the following options.

The third option asks the destination path, like the "move" operator. Then, you can create a new directory and make a complex hierarchy.

Slide Show Functionality

If you can select the "slide show" operation in the "actions" menu or push the "z" key in the listing screen, slide show begins. If you have selected one or more photos or directories, they are shown in the slide show. If you have selected noting, all photos under the current directory are shown. You can start the slide show of a directory by clicking the play icon of the directory. The maximum number of photos in a slide show is 5000.

The following buttons are placed on the bottom of the screen.

If you select one or more photos, the "process checked" menu will appear on the top left of the screen. You can do downloading, moving, and deleting operations from there.

Key binding is also supported. You can skip backward/forward by the left/right arrow keys, and jump to the first/last by the up/down arrow keys. You can select the current image by pushing the space key. You can go back to the listing screen by pushing the "q" key or the "Esc" key. You can hide the control buttons by pushing the "s" key.

Although viewing images are shown in the slide show usually, you can display the original image by pushing "z" key. Then, the "x" key displays the viewing image again. As for movies, you can play and stop by using "z" and "x" keys. Moreover, "h", "l", "k", and "j" keys work as buttons for "previous", "next", "first", and "last". If you push the "c" button, it opens a new window of the editting screen for the current photo.

A list of thumbnails is shown on the top of the screen. You can jump to a specific photo by clicking its thumbnail. You can hide the thumbnail list by clicking the title string in the top right corner or pushing the "a" key. You can display the image in equal size by pushing the "d" key.

I highly recommend you to use this slide show feature to manage your photos. After you finish taking a series of photos, you will confirm them by slide show. While you walk through photos, check marks on failure photos and duplicated photos. Finally, you will delete them. For the sake of the future yourself and friends viewing the photo album, it is better to delete failure photos and keep success ones only. If you can delete failure photos easily, you can take photos more freely.

Publishing Functionality and Security

Basically, only authenticated users can view photos registered in this system. However, each photos is viewable if outer user know its own URL. This simple security policy has pros and cons.

One merit is that you can show photos simply by telling the URL to third parties. You can also share photos by writing URLs in SNSes. Moreover, this system implements publishing features to make it easy to share multiple photos on SNSes. Select the "publish" operation in the "actions" menu or push the "x" key so that you can publish all selected photos in a page where third parties can access without authentication. There are share buttons of some popular SNSes. You can go to the public page of a directory by clicking the share icon of the directory.

One demerit is that confidentiality is not strong. Because the URL of each photo contains random string which cannot be guessed easily by third parties, photos are not accessible by them. However, if you access this system via plain HTTP, all message can be wiretapped by someone and the URLs might be leaked easily. So, if you are conscious of security, please use HTTPS. Still, if you tell the URL of each photo, it will be accessible. Even your close friends can tell the URLs to other person. So, do NOT put confidential or compromising photos on this system (and any system on Internet).

RAW Formats

By default, images in various raw formats are converted into JPEG 2000 (JP2) and saved. You will concern the capacity of your storage if you maintain raw images. However, with JPEG 2000, you will be relieved because data size of each raw image is compressed to from 25% to 30%. For example, a 20MB raw image will be 5MB.

The foremost advantage of raw formats is torelance to degradation of image quality when the image is edited. JPEG 2000 has the same advantage. Due to its algorithm, JPEG 2000 doesn't make any block noise like JPEG. Because the depth of color is 12 bits, recognizable posterization rarely occurs. Moreover, as JPEG 2000 is a standard specification, is is more suitable for long term archive than proprietary raw formats.


Making backup data of this system is very easy. Make an archive in tar.gz and so on of the album directory and save it another place. To restore it, expand the archive and replace the album directory. Note that any storage whether it is HDD or SSD can be break down anytime or you might make mistake to delete important files. So, please make backup data periodically.

Archive files made by "download (meta)" operation can be used as backup data. Making and sending archive data by the download operations is performed on-the-fly so that you can it for servers whose storage volume is close to the limit.

If you migrate photos in this system to another system, you might want to extract the photo files with the original file names. In that case, download exportphoto and run it specifying the album directory and the output directory.

$ mkdir /home/mikio/original_photos
$ ./exportphoto /home/mikio/original_photos /home/mikio/public_html/photo/album

exportphoto is a utility to export photo data from the album directory. It is useful not only for backup but also for migration to another system. The usage is the following.

exportphoto [-view] [-time] [-unique] output_pathalbum_path ...
output_path : the path of the output directory.
album_path : the path of the album directory.
-view : outputs the viewing images instead of the original images.
-time : uses the time stamp as the output file name instead of the original file name.
-unique : uses the internal identifier as the output file name instead of the original file name.
-date : makes sub directories named after each date.

You might want to remove the original images and retain the viewing images only. However, I highly recommend that you keep both of them because you technology is improving day by day. Even if 1500x1000 resolution is enough for most displays now, it is not the case 10 years later, when your children see your photos.


Because bindphoto and viewphoto.cgi are simple Ruby scripts, you can edit them easily to customize their behavior as you want.

You might come to want to correct your photos based on tendency of your cameras. You can do that by modifying definition of some constants around the top of bindphoto.

The identifier of a camera is composed of the maker name and the device name between "::". As for brightness calibration, specify a value more than 1.0 if you want the image to be lighter, otherwise, specify a value less than 1.0 if you want it to be darker. As for white balance calibration, specify the color code of a temperature based on this color temperature list.

Special configuration shooting is a shot when the setting of the "Color Reproduction" (Creative Style mode) is "Landscape" and all of contrast, saturation, and sharpness are "Soft". In that case, parameters of C_special_conf_map are applied. This feature is useful to correct photos for wide angle converters.

You can use external commands to postprocess photo data which you select. To do that, edit viewphoto.cgi to write the configuration of "C_extra_postprocessors" like this.

C_extra_postprocessors = [
  { :title => 'export', :command => './exportphoto -view -unique "./export"', :type => 'text/plain' },

By this configuration, the "export" option is added to the "actions" menu. When you choose it after select some photos, a text file containing a list of the paths of the photo data is created and the command line "./exportphoto -view -unique ./export" which trailed by the path of the list file is executed. In this examele, the viewing images of the selected photos are copied into the "./export" directory. The result log is shown as "text/plain" on the browser.

You can improve accuracy of the auto correction feature by using face detection features of the OpenCV library. To do that, install OpenCV beforehand and then download the file facephoto.tar.gz. After you expand the archive, run the following commands.

$ cd facephoto
$ make
$ sudo make install

Afther the above installation, the auto correction come to set brightness focusing on detected faces. Information of detected faces are shown in the detail columns in image listing screen.


Simple Photo Binder was written and is maintained by FAL Labs. You can contact the author by e-mail to `'.

This software is not more than a thin wrapper of ImageMagick, UFRaw, and etc. I thank developers of the great programs very much.