Offering new extra functionality "scale" and "resize" allow copies
copies made of existing pixbufs at new sizes. Typically a pixbuf will be
an image loaded from disk that would be suitable manipulated prior to
display in a gnocl::image item which has its own buffer resizing
functionality. However, the pixbuf code is pretty fast for scaling
operations in general and so would be useful for simple image
manipulation. Here's how these commands work:
# Create a pixbuf by loading and image from disk.
set pb1 [gnocl::pixBuf load -file ./georgie.png]
# Create copy by simple scale factor, conserves aspect ratio
set pb2 [$pb1 scale 0.25 ]
# Create copy by specifying width scale factors, no conservation of aspect ratio
set pb2 [$pb1 scale -width 0.25 -height 0.25 ]
# Create copy by specific size, does not conserves aspect ratio
set pb3 [$pb1 resize -width 100 -height 150 ]
# Copy with specific width, the height will be calculated based upon image aspect ratio
set pb4 [$pb1 resize -width 100 ]
# Copy with specific height, the width will be calculated based upon image aspect ratio
set pb5 [$pb1 resize -height 150 ]
These commands are pretty straight forward. There may be some function
duplication between modules such as wand, but there are probably some
speed differences. After all, the Gdk/Gtk libraries are designed for
screen rendering and so need to be fast whilst the imageMagick equivalent
supports an internal command pipeline for multiple commands and is
aimed squarely as disk-based image processing.
Subscribe to:
Post Comments (Atom)
-
Given this module some attention today. Added some of the more package wide options to the module and created customised handler for settin...
-
Spent some time today creating some simple howto-tutorials on creating standalone Tcl/Gnocl applications using freewrap. The process is almo...
-
Linux distros have heaps of pre-installed icons ready for use. I recently needed to create a toolbar menu which needed to access a set of un...
No comments:
Post a Comment