I thought I’d put up a couple of small new scripts I wrote for my Cisco IP phone.
The first is a simple image converter. It converts images from any format that the [Python Imaging Library (PIL)][pil] supports and turns it into a Cisco IP Phone Image format (CIP) - a Python version of Cisco’s `gif2cip`). For convenience, the new lines in the images are displayed as a colon, so you can use it in other things where you need to chop up the images into parts by line (for example, my clock). If you want to display the image statically, you would remove them. It assumes you’re using 2-bits-per-pixel (4 colour) output for the Cisco 7940/7960, and that your image is an 8-bit greyscale image. If you have an alpha channel or it’s RGB, the image won’t convert.
It uses a very basic algorithm to downsample the image to 2-bits-per-pixel which probably isn’t perfect in the nature of LCDs, so you may need to tweak the colour value curve in your graphics program if you’re using something other than text. It will also automatically invert the image so black on your computer is black on the LCD. You can [grab the script here][image2cisco].
“It’s ten past two on the [rocket clock][playschool]!”
The second program is a big digital clock Python CGI script. It’s based on the same idea as the “Clock” script from the [Cisco IP Phone Services SDK][servicessdk] (which was originally in classic ASP), with a bigger font and the full date displayed at the bottom of the screen. The image for the digits is embedded in the Python script (which is why the file is so big), which you can change by using the image converter program. You can [grab the script here][clock], and [the source PNG images for the digits here][digits] (only needed if you want to modify the digits). Remember to set the execute bit if you’re using plain CGI (you don’t need to do this if you use mod_python).
I always believe you can’t have too many clocks. :P
[pil]: http://www.pythonware.com/products/pil/ [image2cisco]: /static/projects/asterisk/cisco-hax/image2cisco.py [clock]: /static/projects/asterisk/cisco-hax/clock.py [digits]: /static/projects/asterisk/cisco-hax/digits.zip [servicessdk]: http://www.cisco.com/en/US/prod/collateral/voicesw/ps6788/phones/ps379/product_data_sheet09186a00800925a8.html [playschool]: http://en.wikipedia.org/wiki/Play_School_%28Australian_TV_series%29