DISCOVER
X

Raspberry Pi Image Cruncher Part 2: Preparing the Pi

August 6, 2014 11:12 pm Leave your thoughts
FacebooktwitterredditpinterestlinkedinmailFacebooktwitterredditpinterestlinkedinmail

Raspberry PiWelcome to Part 2 of the Raspberry Pi Image Cruncher. We will talk about preparing the Raspberry Pi for our image cruncher.

We know that we will use Python with ImageMagick  for resizing and Own Cloud for the image sharing medium. To do that we have to make sure our Raspberry Pi have all the pre-requisite libraries.

Image Libraries

The resizing library that we will use is ImageMagick via Wand. I have chosen to use Wand as it’s one of the simplest one that can be used from a Python script.

Installing Wand is straightforward, however we do need PIP for easier installation. The Raspbian version that I use does not have PIP yet, therefore I had to install it first.

So let’s install PIP using get-pip.py:

  1. Download the get-pip.py script from here: https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py
  2. You can put the file anywhere in the Raspberry Pi
  3. Run the following command: sudo python get-pip.py
  4. Don’t forget to use sudo
  5. If installation goes well, when you run pip -h from the command line, you’ll see the help screen.

After installing PIP, all we have to do is install the Wand libraries.

This should be enough for our resizing library preparations.

OwnCloud Access

Another requirement that we have is to be able to access the files uploaded from the phone via OwnCloud. Thankfully, OwnCloud has support for WebDav therefore it’s possible to access the uploaded files via external scripts such as python scripts.

Note that we use WebDav because it’s not good to access the files from OwnCloud directories directly. Things like incomplete files being accessed might happen that way.

Anyway, to prepare for this we just need to install the DavFs and configure it for our access.

The commands above install the davfs support as well as ensuring that the fuse device is recognized by the system. In addition, adding the pi user (or if you are using a different user adjust this) to the davfs2 group ensures that every files mounted using davfs will be accessible to the user.

Once installed we then configure the davfs for our owncloud access.

First we create the directory to house our davfs2 configurations.

Then we create the configuration file, which is called secret

Add the following information to the secrets file

Naturally change the <owncloud_username> and <owncloud_password > to your own OwnCloud account.

Lastly we need to setup the mount so that we can access our OwnCloud files from within the Raspberry Pi console. In this tutorial we will use owncloud directory in the home directory to house the mounted DavFs Owncloud files. So let’s create the owncloud directory.

Then we edit the file /etc/fstab, add the following command at the end of the file. This ensures mount paths for the DavFs is setup properly to the directory that we just created.

Execute the command sudo mount -a to test out if the mount is done properly. If it is then as soon as you cd ~/owncloud/ you will see your account’s files.

Continue to Part 3: The Script

This concludes part 2 preparation of the Raspberry Pi Image Cruncher. We will talk about the actual resizing script and automation on part 3.

 

FacebooktwitterredditpinterestlinkedinmailFacebooktwitterredditpinterestlinkedinmail
Tags: ,

Categorised in: ,