Tuesday, March 16, 2010

Save pixBufs with compression etc..

The Gtk+ libraries upon which the pixBuf save command is implement are in to forms, one that does a ‘plain vanilla’ save and one which receives a list of parameters whose names and values change in relation to the file type being saved out to. Saving with compression, for instance, can result in a marked reduction in file size so this feature needed to be available from the scripting point of view. The following lines of Tcl/Gnocl code illustrate the usage:

$pb2 save -fileName test2.tif -fileType tiff
$pb2 save -fileName test3.jpg -fileType jpeg
$pb2 save -fileName test4.jpg -fileType jpeg -parameters [list quality=50]

Here the option -fileType is specified as there is no internal checking of file extensions. (Put this on the todo list!).


No comments: