Version 3 of Captioning Photo Image under Pixane Example

Updated 2011-05-30 23:55:52 by gold

Captioning Photo Image under Pixane Example

This page is under development. Comments are welcome, but please load any comments in the comments section at the middle of the page. Thanks,gold


gold Here is an eTCL script to estimate timing photo image loading under pixane. This script was largely derived from posting of Eric Hassold on The comp.lang.tcl newsgroup The timing statements were pulled from the program below after the timing info was calculated. The impetus for the script was an ask9 question about time of "loading single image ...". My solution to a different application on Unix some grey hairs ago was creating batch thumbnails with Image Magick, before loading the application script. If one can work with thumbnails, a tcl or perl script can use Image Magick to thumbnail every image in a directory or tailor to specific megabyte size. Since now, I'm using etcl and pixane on an Acer Aspire pc notepad, it might be desirable to establish some peg points or timing results with the pixane image library. The timing results with pixane are similar to those reported for Image Magick on a Pentium, Fast image resizing


In planning any software, there is a need to develop testcases.

 Testcase 1.
  Output of timing statements.
quantitynumberunits
photo size of bird.jpg 1.6 m
loading 1595970 microseconds per iteration
Scaling (1944 x 2592) => (180 x 240)pixels
resizex 68 microseconds per iteration
blanking 4283 microseconds per iteration
rescale 230934 microseconds per iteration
saving 14458 microseconds per iteration
proc time 1863222 microseconds per iteration

Screenshots Section

http://img718.imageshack.us/img718/9282/image35.gif


Comments Section

Please place any comments here, Thanks.


References:


Appendix TCL programs and scripts

* Pretty Print Version

        # Pretty print version from autoindent
        # and ased editor
        # program of image captioning under pixane
        # written on Windowws XP on eTCL
        # working under TCL version 8.5.6 and eTCL 1.0.1
        # gold on TCL WIKI , 25may2011
 package require Tk
 package require pixane
  console show
    global targetpix photox
    proc jackpix {} {
        global targetpix photox p
        # File to comment
        set fin [file join [file dirname [info script]] bird25.jpg]
        set fout [file rootname $fin]_new[file extension $fin]
        # Comment
        set caption "bird of yore"
        set p [pixane create]
        pixane load $p -file $fin
        set widthsource [pixane width $p]
        set heightsource [pixane height $p]
        set heightvirtual2 [expr {$heightsource+32}]
        pixane resize $p $widthsource $heightvirtual2
        pixane color $p "\#C0C0F0"
        pixane rect $p 0 $heightsource $widthsource $heightvirtual2
        pixane color $p "\#101020"
        set font [pixfont create -builtin "sansserif"]
        pixane text $p [expr {$widthsource/2}] [expr {$heightvirtual2-($heightvirtual2-$heightsource)/4}] \
                -font $font -size 20 \
                -align center -valign baseline \
                -text $caption
        pixane save $p -file $fout -format jpg
    }
    global p
    jackpix
    set tkpicturex [pixcopy $p]
    wm title . "Captioning Photo Image under Pixane "
    pack [canvas .c -width 400 -height 400 -background grey]
    proc moveobject {object x y} {
        .c coords $object [expr $x-25] [expr $y-25] [expr $x+25] [expr $y+25]
    }
    proc moveobject2 {object x y} {
        .c coords $object [expr $x-25] [expr $y-25]
    }
    set egg [.c create oval 75 75 100 100 -fill bisque]
    set bird [ .c create image 200 200  -image $tkpicturex ]
    .c bind $egg <B1-Motion>  {moveobject $egg %x %y}
    .c bind $bird <B1-Motion>  {moveobject2 $bird %x %y}
    grid .c -row 0 -column 0
    bind . <Motion> {wm title . " Captioning Photo Image under Pixane Example "}
    
    
    
    

Code scraps, timing statements

        puts " loading [time {pixane load $p -file $fin} ]"