Categories
Uncategorized

Raspberry Pi Slide Show

Slideshow

I’ve been using Raspberry Pi single-board computers for video players for years now, and I’ve also used them as audio players, but I was missing a good way to use them as slide show devices… Until now.

I’ve used Screenly OSE for the MMPIS at Milwaukee Makerspace, and while Screenly is great for what it is (a network-connected, browser-controllable, digital signage device) sometimes you don’t want all the options and features and you don’t have a network. So I needed another solution.

I found fbi, “the Linux framebuffer imageviewer”, which can run at boot up and display a folder full of images at full screen with a configurable delay between changing images. Perfect!

Boot Volume

Now, there’s one more thing… If I’m going to put this somewhere that doesn’t have a network connection (like, in a museum) I want to be able to easily update the slides. The slides won’t be changing daily, but may be changing every month or so. For something like this it’s easy to store the images directly on the /boot volume, which is accessible on the SD card when you pop it in a Mac OS X or Windows computer.

You’ll notice a folder names “slides” and a file named “slideshow.sh”, which do the hard work here. It’s actually ridiculous to call it “hard work” because it’s dead simple. The slides folder contains images which will be displayed in alphabetical order. (Sadly, my screen shot does not reflect this!) In an ideal world you’d name your images 0001.jpg, 0002.png, 0003.jpg, etc. Just name them in order, and they’ll display in order. Easy.

Images

The SD card only has about 40MB of free space for you to put images on, but with JPG compression of photos, you can probably fit plenty of them. OK, so once you’ve got your folder full of images (which you can easily update on the SD card) you’ll need some way to run the slideshow.sh script.

Typically I do a sudo nano /etc/rc.local and add what’s needed to run my script. In this case it’s the /bin/bash /boot/slideshow.sh & you see on line 20. Oh, don’t forget to set the Pi to auto-login at boot. Since it’s been added to recent versions of Raspbian you don’t even have to muck around anymore.

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

/bin/bash /boot/slideshow.sh &

exit 0

So yeah, we’re all set… but you probably want to see the code in slideshow.sh, right? This is it. Right here. Yes, it’s pretty much just two lines. Linux is like that sometimes… It’s not hard implementing something, it’s just hard finding out exactly how to implement something. It can be hard finding those two lines that you need! (The 200 may need adjustment. Longer may be better, but in my testing on a Raspberry Pi 2 Model B it worked well.)

#!/bin/sh

sleep 20

fbi -a -t 6 --blend 200 --readahead --noverbose -T 1 /boot/slides/* >/dev/null 2>&1

There’s some parameters you can set, like -t 6 which sets each slide to display for 6 seconds, and the blend thing, which sort of works. Hey, it’s a slide show, okay!?

I’ll probably work on this more, but I was pleased to find a solution so I thought it was worth sharing.

Categories
Uncategorized

Processing PhotoBooth v3

Simple Photobooth

It’s become a tradition around here to update my simple photo booth using Processing when a new version of Processing comes out. I’m not sure Processing 3.x is final yet, but I’m using it, and it’s got all sorts of good stuff. (You probably remember Processing PhotoBooth v2 and Processing PhotoBooth, which are both deprecated now, but see them to know what I’m talking about.)

One of the things new in Processing is the fullScreen() function, which gets rid of the whole “figure out the size of the display” issue, by just saying “run at full screen”!

There’s also a new thing called settings() which can appear before setup(), but I won’t get into that…

Here’s some code!

/**
 * PhotoBoothV3.pde
 */
 
import processing.video.*;
Capture cam;

void settings() {
  fullScreen();
}

void setup() {
  colorMode(RGB);
  String[] cameras = Capture.list();
  if (cameras.length == 0) {
    exit();
  } else {
    cam = new Capture(this, cameras[0]);
    cam.start();
  }   
  noSmooth();
  background(0);
}

void draw() {
  if (cam.available()) {
    cam.read();
    image(cam, 0, 0);
  }
} 

void keyPressed() {
    if (key == ' ') {  // space bar
       saveFrame("Picture-######.jpg");
    }
}

And hey, once again you’ve got a simplistic photo booth application. Congratulate yourself by purchasing this lovely button for it. (Or get this “bare” button and build your own damn case.)

Now, I don’t know if the fullScreen() thing has a bug, or if it’s my setup, but here’s what I’m seeing. I typically run my display at 1440×900 using QuickRes, which is a non-standard setup. When I ran the sketch it seemed to display at 1280×720 in the upper-left corner. My guess is that the camera is only capturing 1280×720, so the sketch only fills that amount of the display, no matter what the resolution is. I’ve tested it at higher resolutions and get the same thing. If I set the display to 1280×800 it’s all good.

This is most likely not a bug, but a “thing to be aware of” in the future…

Besides all that, the most exciting thing about Processing lately is that there is finally an official version that runs on the Raspberry Pi! This is super-awesome and has great potential for artists and others who do exhibits and installations. I’ve already got a few ideas in the works. ;)

Categories
Uncategorized

Hoover Dam

Hoover Dam Power Plant
Hoover Dam Power Plant

Hoover Dam Bypass
Hoover Dam Bypass

Hoover Dam
Hoover Dam

I was at Hoover Dam last week, and I got a few photos of the place. I’d never been to the Hoover Dam before. I’ve never even been to Nevada before, though I did once live on Nevada Street, and have a connection to the guy who used to run Nevada Power.

(Oh, we also shot a lot of other things, but these are just a few panoramic shots I did while we were at the dam.)

Categories
Uncategorized

Shoot RAW

Occasionally I have a conversation with someone about whether you should shoot JPEG or RAW with a DSLR. I almost always shoot RAW. There’s a time and place for JPEG, but I avoid those times and places when I can.

Here’s a great example of what you can get when shooting RAW. I was walking through our kitchen and saw these mourning doves through the window. Well, through two panes of slightly dirty glass, on an angle, uphill. I fired off a few shots, and this was the best one I got.

Before

This photo is sort of terrible. I mean, the shot itself is useable, but we need to coax the awesome out of it, which you can do with a RAW image.

After

Here’s the results after tweaking the sliders in Photoshop. (You can view it larger on Flickr.)

From what appeared to be a terrible shot on the camera screen was transformed into a totally useable shot on the computer screen, through the magic of shooting RAW!

Shooting RAW is like shooting on film, which is why we say we have to “process” the image. Converting the RAW image is akin to developing film. (And yes, there are alternatives to Photoshop for processing RAW images, it’s just the one I tend to use the most.)

Categories
Uncategorized

Processing PhotoBooth v2

Simple Photobooth

If you saw my old post about a simplistic photo booth using Processing, you probably loved it so much that you used it, and you probably loved using Processing so much that you used that too, and you even installed the betas of Processing 2.0, and then you cursed out loud as the code no longer worked.

Calm down, sport… we’re here to help.

While not final yet, Processing 2.0 has a lot of changes compared to Processing 1.5.x, and those of us who dabble in writing sketches can expect some breakage, but we can also attempt some fixage.

Here’s what I’ve got now… which works for me! (YMMV)

/**
 * PhotoBoothV2.pde
 */
 
import processing.video.*;

// resolution: 800x600 - change it if you want
int cols = 800;
int rows = 600; 

Capture cam;

int mainwidth  = cols;
int mainheight = rows;

void setup() {
  frameRate(30);
  size(mainwidth, mainheight, JAVA2D);
  colorMode(RGB);
  cam = new Capture(this, cols, rows); 
  cam.start(); 
  noSmooth();
  background(0);
}

void draw() {
  if (cam.available()) {
    cam.read();
    image(cam, 0, 0);
  }
} 

void keyPressed() {
    if (key == ' ') {  // space bar
       saveFrame("picture-####.jpg");
    }
}

Boom! You got a simplistic photo booth application. Congratulate yourself by purchasing this lovely button for it. (Or get this “bare” button and build your own damn case.)

Also, special thanks to Evil Mad Scientist for releasing their Atkinson Dithering sketch, which reminded me I had to fix my Processing code, and provided some hints on what needed updating.