Tk Source Code

View Ticket
Login
Ticket UUID: 1576528
Title: image read file from co-ords
Type: Bug Version: obsolete: 8.5a4
Submitter: alastair_davies Created on: 2006-10-13 12:35:21
Subsystem: 42. Photo Image|GIF Assigned To: dkf
Priority: 5 Medium Severity:
Status: Open Last Modified: 2006-12-06 05:41:30
Resolution: None Closed By:
    Closed on:
Description:
The /image/ read /file/ -from x1 y1 x2 y2 command does
not work correctly.  The following script uses the
ActiveTcl example gif of the earth from space.  The
rectangular region (152,62) to (185,97) encloses
Madagascar.  The displayed region is from the top-right
hand corner.

package require Tk
set fname C:/Tcl8.4/demos/Tk8.4/images/earth.gif
canvas .c
pack .c
set img [image create photo]
$img read $fname -from 152 62 185 97
.c create image 0 0 -anchor nw -image $img
User Comments: alastair_davies added on 2006-10-13 19:45:05:
Logged In: YES 
user_id=988604

Just for comparison, here is the equivalent /image/ copy
/image/ -from x1 y1 x2 y2 code, which does work correctly.

package require Tk
set fname C:/Tcl8.4/demos/Tk8.4/images/earth.gif
canvas .c
pack .c
set img1 [image create photo -file $fname]
set img2 [image create photo]
$img2 copy $img1 -from 152 62 185 97
.c create image 0 0 -anchor nw -image $img2