A Raspberry Pi image cruncher, this is something that I have been wanting to write about for quite some time. The plan is to get this article out weeks ago however I had to hold back and make sure that the script and processing actually works all the time.
Most of us take a lot of photos with our smartphones, personally I have thousands of photos taken using my mobile phone. I think this is because the quality of the mobile phone photos are getting better and better. Taking pictures of close ups and great sceneries are more possible than ever using mobile phone these days.
Of course, with quality comes size as well, both the image dimension and file size are good for printing and high resolution viewing, but perhaps not really necessary for blogs. Another blog that I have started is mobile shots which I use to showcase my mobile photos. The problem that I encountered is of course, I’m unable to upload the images straight away, I have to resize down the image first. This is due to both bandwidth and memory allocation.
So to outline the goals, the Raspberry Pi Image Cruncher has to:
- Automatically resize the images as soon as they are transferred to the raspberry Pi server
- Able to recover from any errors
- Able to save the resized image into a separate sub-folder
- Able to automatically share the resized image to all of my computers
- Allow uploading the photos directly from my mobile phones
Most problems that I encountered from implementing such processor is that the Raspberry Pi is very limited in terms of processing power and RAM. Image processing is no small task therefore it’s possible to encounter crashes during processing, especially if the image being processed is too large in size.
Another potential problem is multiple resizing processes running at once. The automation plan is to simply use a cron job, however we need to make sure that if the process takes a long time, another process does not get started.
Following through from the previous potential issue, is speed. Processing images though JPEGs from mobile phone will still take long for the Raspberry Pi. So we need to ensure that the the resizing process per files does not get started too soon. We need to limit the number of parallel processing in our Raspberry Pi image cruncher.
Knowing our goals and potential problems, we now move on to implementation. The plan to be exact. The Raspberry Pi Image Cruncher will run as a python script. Utilizing image magick for resizing. In addition file synchronization form mobile phones and other devices will be done using Own Cloud. If you haven’t install owncloud on a Raspberry Pi, follow our instructions here and to add external harddrive, follow the instructions here.
Continue to Part 2
Since this is going to be a long article, I decided to split it into multiple parts. Follow to part 2 for the script preparations.image resizer, python, Raspberry Pi