Updated 2013-03-05 01:56:44 by pooryorick

Summary  edit

Richard Suchenwirth 2003-07-29: Dilbert comics appear daily on http://dilbert.com and can be saved from a browser - weekday strips as GIF images, sunday strips as larger JPEG images (too many colors for GIF). For reading them on a PocketPC, the size is a bit inconvenient, so in some idle minutes I hacked together the following proc, which from a locally downloaded Sunday Dilbert

  • cuts out the two strip rows (i.e. without the title bar that occupies the upper third) and
  • pastes them lengthwise into another image,
  • which you then can save as JPEG image and
  • transfer to the little box.

No Img on iPaq, so for now it can be only browsed with IE.

SRIV: note: Img is available for Linux iPaq. A starkit I made is available here

In any case, this demonstrates how easy "scripted image processing" is with Tk...

proc dilbert'sun2long filename {
    package require Img ;# since Sunday Dilberts are JPEGs
    set i1 [image create photo -file $filename]
    set w [image width $i1]
    set h [image height $i1]
    set h1 [expr {int($h/3.)-10}]
    set h2 [expr {round($h*2/3.)-16}]
    set res [image create photo]
    $res copy $i1 -from 0 $h1 $w $h2
    $res copy $i1 -from 0 $h2 $w $h -to $w 0
    image delete $i1
    set res