#10 magicktophoto creates bogus transparency

open
nobody
None
5
2005-02-28
2005-02-28
Anonymous
No

FreeBSD 4.8-RELEASE
TclMagick-0.45
ImageMagick-6.1.9.4
Tcl version 8.4.9

I am seeing wierd results from
magicktophoto. It appears that the
photo image gets assigned transparent
pixels when the magick image contains
no transparent pixels.

Run the attached prog. It reads a
gif image via Tk's "image -file" and
TclMagick's ReadImage. Both images
are then displayed. The gif should
be a reasonable size, I used 300 x
400. Don't start with a gif that has
a transparent color index.

Click on the "Shrink" button to have
TclMagick resize the image by -25
pixels. The result is displayed.
Most of the time I am seeing random
horizontal rows that are now
transparent. Sometimes the entire
image is transparent.

However, if the image is written as
gif files (presumably TclMagick will
set the transparent color index in
the gif), and then the image is
displayed using "display" you can see
that there seems to be no transparency.

If I run this loop:

for {set i 0} {$i < [image width $gif]} {incr i} {
for {set j 0} {$j < [image height $gif]} {incr j} {
if { [$gif transparency get $i $j] } {
puts "Found transparent pixel: $i,$j"
}
}
}

then, indeed, there are many transparent
pixels found.

So, it appears that magicktophoto is
somehow setting Tk's transparency
when it should not.

Dave Bodenstab
mrdave@spymac.com

Discussion

  • Nobody/Anonymous

    test program

     
  • Nobody/Anonymous

    Logged In: NO

    This seems to be fixed with later versions of ImageMagick,
    so it appears this is not a but in TclMagick.