I've successfully displayed .jpg files in a paintable canvas from a database after slightly tweaking this code.