Marco Pontello's Home Page
Questa pagina in italiano

(Last updated: 19/11/16)


BubbleRand - A command line driven photo bubbler

This was mostly an excuse to play a bit with the Python Image Library (PIL).
Contrary to most other on-line or standalone bubblers, BubbleRand is used as a script and take an image, a mask, and then start creating random bubbles to avoid showing the masked zones. It can also create gradients, and generate a number of frames.

Now for some samples - thanks to my friend Manu for allowing me to use some photos of her.

Here's an image generated using just a simple mask. Red pixels marks the zones that should not show:

It's also possible to use the blue color to ensure that some zones will show:

Here's an Animated GIF created assembling 6 different frames:

A look to all the different options and some notes:

 BubbleRand v1.03 - (C) 2012 By M.Pontello

 usage: [-h] [-v] [-f num] [-m mask] [-s factor] [-o output] 
                      [-c1 color1] [-c2 color2] [-vg] [-b] [-d]

 Create bubbled images from an image & mask pair

 positional arguments:
   image          original image file

 optional arguments:
   -h, --help     show this help message and exit
   -v, --version  show program's version number and exit
   -f num         frames to create (default: 1)
   -m mask        mask to use (default: None)
   -s factor      rescale bitmaps before processing (default: 1)
   -o output      output filename (default: bub.bmp)
   -c1 color1     starting gradient color (default: black)
   -c2 color2     ending gradient color (default: blue)
   -vg            vertical gradient (default: False)
   -b             bigger bubbles (default: False)
   -d             display output (default: False)

The only needed parameter is the source image file (in any usual format). If the mask name is omitted, it's assumed to be a PNG file, with the image name + "_mask". If the "-f" switch is used to create many frame, a 5 digit counter is added just before the file extension.

The "-s" switch is used to get better quality results when dealing with low res images. Or can be less than 1 to speedup the calculations. The option to use bigger bubbles is useful when the images have large areas that should remain hiddens, as small bubbles will tend to show the outline of the mask.

It's possible to specify an output filename; the format will be determined automatically by the file extension.

When creating gradients, it's possible to use any color string recognized by PIL, like "yellow", or "#ffff00", etc.

To quickly show the results (if only one image is created), use the "-d" switch.

N.B. Need Python 2.7.x installed.


BubbleRand v1.03, 2KB ZIP

Change Log

BubbleRand v1.04 - 24/07/12:
+ Added a small watermark.
- Minor speedup.

BubbleRand v1.03 - 16/05/12:
- Speed up the bubbling process.
- Better red/blue threshold evaluation normalizing mask.
+ Added the option to use bigger bubbles.

BubbleRand v1.00 - 11/05/12:
- First version released.