Over the holidays I created a simple static photo gallery generator that I named chobi. The sources are in https://github.com/abhinababasu/chobi.
Given a source folder of photos, chobi will generate a destination folder containing the original photos, generated thumbnails, css stylesheets, scripts and html files which constitute a website displaying those photos as follows
The Problem
While building chobi and also when I was looking into similar online tools, I kept hitting a major issue and that prompted further work and this post.
You see thumbnail generation from image has a major problem. I needed the gallery generator to create square thumbnails for the image strip shown at the bottom of the page. However, the generated thumbnails would simply be either from the center or some other arbitrary location. This meant that the thumbnails would cut off at weird places.
You see thumbnail generation from image has a major problem. I needed the gallery generator to create square thumbnails for the image strip shown at the bottom of the page. However, the generated thumbnails would simply be either from the center or some other arbitrary location. This meant that the thumbnails would cut off at weird places.
Consider the following image.
If I create a thumbnail from a tool without knowing where the face is in the image, it will generate something like
Obviously that doesn't work. So using my vanilla generator I got a website with all sorts of similar head chopped off thumbnails (marked in Red)
The Solution
Chobi uses face-detection to ensure that does not happen and the face is always fully present in the generated thumbnail. Consider the same thumbnail as above but now with face-detection
Another example of an original image and then generated thumbnail first without and then with face-detection.
With this face-detection plugged in chobi generates a much better web-site, with almost no photo cropped where it shouldn't be.
Sources
- Chobi sources are at https://github.com/abhinababasu/chobi
- It uses the face-detected thumbnail generator which I wrote at https://github.com/abhinababasu/facethumbnail.
- That is in turn is based out of a face detection library pigo written fully in go
Sample
Checkout a gallery build using chobi at