Dec 22 2007

Canon iP2200 – borderless printing under Linux

I picked up a Canon printer a while back – specifically a Pixma iP2200. Getting it to work properly under linux has turned out to be… somewhat challenging.

Since I run Ubuntu at home, the page at the Ubuntu wiki does a good job of getting the printer set up and working.

The only trouble is that printing photos turned out to be a problem – none of the programs I tried seemed to be able to print properly. Most of them seemed to use gutenprint (aka gimp-print) which had no driver for the iP2200 by default, and when I specified the ppd file from the Canon setup, I wound up with about 3/4 of an inch of the left side of the image on the far right of the paper. Even when I did manage to get a decent printout, I was stuck with a border on the print.

After looking into it for quite a while, I happened across a document for the iP2500 – it talked about a program (supplied with the Canon driver for the printer) called cifip2500. It supported command line options for borderless printing.

[EDIT: It turns out that if I had bothered to grab the manual Canon supplied, the information is there as well....]

Checking on my own system, I found a corresponding program called cifip2200. Running cifip2200 –help gave me this output:

Canon Inkjet Print Filter Ver.2.60 for Linux
Copyright CANON INC. 2001-2006
All Rights Reserved.

Usage: cifip2200 --gui (gui mode)
cifip2200 [switches] [file]

switches: [ --imageres 1 - 32767 ]
[ --cartridge cartridgetype ]
[ --media mediatype ]
[ --halftoning halftonetype ]
[ --quality 1 - 5 ]
[ --grayscale ]
[ --papersize size ]
[ --paperload position ]
[ --borderless ]
[ --extension 0 - 3 ]
[ --location position ]
[ --fit ]
[ --full ]
[ --percent 20 - 400 ]
[ --copies 1 - 999 ]
[ --renderintent intent ]
[ --gamma 1.4 / 1.8 /2.2 ]
[ --balance_c -50 - 50 ]
[ --balance_m -50 - 50 ]
[ --balance_y -50 - 50 ]
[ --balance_k -50 - 50 ]
[ --density -50 - 50 ]
[ --inkcartridgesettings cartridgetype ]
[ --bbox left,bottom,right,top ]

As you can see there is a –borderless option, and options to set lots of other things as well. During my first attempt, I was surprised to get lots of control characters scrolling across my screen – turns ou8-bit per color RGB/8-bit Gray/Index/8-bit per color α RGB/8-bit α Grayt that the program output is intended to be redirected to the printer (or a file). My print command looked like this:

cifip2200 –media glossypaper –papersize 4X6 –fit –picture.tif > /dev/usb/lp0

That generated a very nice picture (in this case of my dog with antlers, taken for Christmas), but didn’t work until I ran it as root, and shut down cups, since it complained that the printer was busy.

So, the full list of restrictions at the moment with this method:
1) Limited file formats based on documentation for the iP2500 version:
TIFF:Uncompressed mode only
BMP: Only 8-bit per color RGB
PPM: Only 8-bit per color RGB (binary format)
PNG: 8-bit per color RGB/8-bit Gray/Index/8-bit per color α RGB/8-bit α Gray

2) Must be run as root

3) Cups must be stopped to allow access to printer

Presumably the pstocanonij program used as the cupsFilter in the ppd file takes the postscript generated for cups, and converts it into a supported format which is then printed using cifip2200. This is supported by the fact that the bottom of the ppd file has options that match the above options very closely (except for –boderless not being present).

One thing that puzzles me is that no resolution is specified for cifip2200 – does it choose based on the quality setting, and the input file? If so, then resolution settings in the .ppd file are merely for the postscript file (and conversion to image). In any case, I have a solution for now and some more testing to do to determine how to get optimal quality. If I recall correctly, the pstocanonij code is available, so once I get everything figured out, it may be possible to add the borderless setting, either by default or as an option.

[edit: The documentation says that the default resolution is 120dpi, and gives an example of setting it to 60dpi. Seems strange considering the specs say 600-2400 dpi...]

-This is my first attempt at a post using the QTM blogging software-


Sep 20 2007

8830 Media Format followup

I wasn’t completely sure that I was correct when I said that the 8830 required an .mp4 container, but I’ve come across a Document on the BlackBerry site that lists supported media for the 8100, 8300 and 8830. It clearly states ‘The BlackBerry World Edition smartphone is unable to play .avi files’.

Not sure why it can’t, when the rest can, but it certainly explains my trouble trying to generate playable .avi files.

I also came across information that suggests that mencoder can output using the correct container format, and that the trouble could be the fourcc being used…. I’ll follow up on that once I’ve had a chance to do some testing.

update:

While you can convince mencoder to use other containers, the support is still buggy. The .avi container is the one to stick with if using mencoder, unfortunately, that makes it useless for the 8830.


Sep 10 2007

GPS and Video on the Blackberry 8830

We switched service providers at work, and as a result switched to new Blackberrys. Since my position involves international travel, that meant that I got one of the spiffy ‘World Edition’ 8830s. The two things about it that I wanted to explore a little were the gps capability and it’s media support.

On the gps front, it has a full internal gps, unlike a lot of cell phones that can only determine location with the assistance of cell towers. There are a few commercial applications out there that support the unit, but I was unwilling to pay $25 or more when the unit already has an included mapping package and the ability to install google maps. Since the missing feature as far as I’m concerned is logging of position over time, I naturally went looking for open source solutions. I found a few different programs, but the one that worked for me was bbTracker. It tracks the position, displays it on the screen, and saves the track to the Blackberry. Once you have a saved track, you can export it in a couple of formats, and use it to do things like display in Google Maps.

I did run into one problem with bbTracker – it seemed like it wouldn’t work for me at first, everytime I tried to use it, it would crash. The crashing is definitely a bug, but there turned out to be an easy workaround. The problem is that if no gps position has been calculated when you start a track, when it gets the first position it crashes. To avoid this, you need to wait for a position to be displayed before starting a track. Other than that, it does what I want. The next trick is to take the track data and use it to automatically tag my photographs with location data.

Once I had gps working, I then turned my attention to converting video into a format that would play on the 8830. RIM has a page that lists the supported codecs, etc. but I had a lot of trouble getting anything to work. It seemed like no matter what I did, it told me the format was not supported. Since I’m primarily a linux user, the fact that the Roxio Media Manager application converts videos to the right format didn’t help as a long term solution. It did however give me a valid file to look at – and using that I managed to figure out how to successfully convert videos.

The solution appears to be to use a .mp4 container, not a .avi container. My initial conversion attempts all used mencoder, but I had to switch to ffmpeg to get it into an mp4 container. To make that work on Ubuntu, I wound up having to recompile ffmpeg since the required codecs are not supported by default. If you need to do the same thing, these are what I used.

The actual command I’m using looks like this:

ffmpeg -i input_file.mpg -f mp4 -vcodec mpeg4 -maxrate 800k -b 700k -qmin 3 -qmax 5 -bufsize 4096 -g 300 -acodec aac -ab 64 -s 320:240 -aspect 4:3 output_file.mp4

There appear to be a couple ‘correct’ resolutions – 320×240 is full screen, 4:3 aspect ratio, 240×180 is the ‘recommended’ 4:3 resolution, and 320×180 is the right one for a 16:9 aspect ratio.

I suspect there are a bunch of tweaks that can be applied to this yet, for instance, I suspect I can reduce the base video bitrate can be reduced a little, but for now I’ve figured out how to convert movies that will play.