I wrote addcap.py to be able to add comic bubbles and captions to photos.
get it on github.
Images have (x,y) pixel coordinates like quadrant 4 in the Cartesian plane. You don’t need to know that. The upper left corner is (0,0). Moving to the right increases x. Moving down increases y.
On an image with dimensions 800×600 the middle point is (400, 300).
Addcap will draw a caption bubble on your image but you have to tell it where. It needs a starting point, and for you to tell it which corner that point is. Addcap will always draw down and to the right. If you tell it the lower right corner coordinate(LOWER_RIGHT), then it will figure out where upper left is and draw from there.
You can pass all kinds of other options too. Check them out with -h.
python addcap.py -h
usage: addcap.py [-h] [-i IMG] [-sx STARTX] [-sy STARTY] [-tw TEXTWRAPWIDTH]
[-fs FONTSIZE] [-cc CHARACTERCOUNT] [-sc STARTINGCORNER]
[-ca CALLOUTARROW] [-f FOLDER] [-o OUTFILE] [-qf QUOTEFILE]
[-q QUOTE [QUOTE ...]]
-h, --help show this help message and exit
-i IMG, --img IMG Image to add a caption to.
-sx STARTX, --startX STARTX
Starting X Coordinate for caption bubble.
-sy STARTY, --startY STARTY
Starting Y Coordinate for caption bubble.
-tw TEXTWRAPWIDTH, --textWrapWidth TEXTWRAPWIDTH
How many characters before a line wrap in the bubble?
-fs FONTSIZE, --fontSize FONTSIZE
-cc CHARACTERCOUNT, --characterCount CHARACTERCOUNT
Character count. limited to 140 by default.
-sc STARTINGCORNER, --startingCorner STARTINGCORNER
The corner that your start coordinates create. Values
are Values are UPPER_LEFT, LOWER_LEFT, LOWER_RIGHT,
-ca CALLOUTARROW, --calloutArrow CALLOUTARROW
Which call out arrow do you want, starting at
11oclock, going counter clockwise. Just put the
number, like 6
-f FOLDER, --folder FOLDER
If defined, create a folder and store addcap images
there. Otherwise defaults to current folder.
-o OUTFILE, --outfile OUTFILE
The outfile prefix name. Will append a number and JPG
to the end.
-qf QUOTEFILE, --quoteFile QUOTEFILE
A file with 1 quote per line. Quotes should not exceed
-q QUOTE [QUOTE ...], --quote QUOTE [QUOTE ...]
One or more quotes in the form "This is a quote.",
"This is another quote", "This is yet another quote".
Individual quotes should not exceed 140 characters.
If you run demo.sh, then addcap will create a demo folder for you and fill it up with examples.
All images pulled from FLICKR searching on ‘bad taxidermy’ where the CC flag was set to yes.
(C)Attribution Share-Alike License