Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#1587 image put errors on {} color

obsolete: 8.4.4
Jeffrey Hobbs

image put dies when passed "" as a color, although this
can be used in various other places in Tk to mean
an "empty" color or transparent color. image put should
do the same, so you can pass in large color arrays that
don't specifically have to set a color for all pixels.


  • Logged In: YES

    Q1: Does this require a TIP to fix?
    Q2: Should the empty string indicate that a pixel is to be
    ignored or that a pixel is to be made transparent?

  • Patch

  • Jeffrey Hobbs
    Jeffrey Hobbs

    Logged In: YES

    1. It requires a TIP if you view it as not a bug.
    2. This may justify it more as TIP-worthy.

  • Logged In: YES

    I've been thinking about this a bit more, and I feel that
    the empty string ought to represent a transparent pixel, and
    not a pixel that should be ignored when writing into the
    image. The idea is that you are putting a blank into the image.

    OTOH, I might do a TIP for all this anyway so that I can add
    a syntax for specifying non-trivial transparency at the same

  • Logged In: YES


    Could you look at the last part of FR 557090 before TIP'ing,
    dealing with "xcolor@alpha" syntax ?
    Then, setting transparent pixel could be done with @0, and ""
    could denote a "do nothing" behaviour.

  • Logged In: YES

    It's *extremely* difficult to get both @0 and "" supported
    at the same time with different behaviour as you suggest.
    The problem is that setting a pixel to be transparent
    requires one kind of compositing rule (set) and ignoring a
    pixel requires another (overlay).

  • Logged In: YES

    You're right, I missed that.
    So, let "" raise an error and @xx deal with alpha ;)

  • Logged In: YES

    Wrong answer. Make the empty string work and make @xx throw
    an error instead. Which is as far as I could see myself
    going without a TIP (since arguably the empty string is
    already interpreted in Tk as transparent and alpha support
    is currently abysmal.)

  • Logged In: YES

    I'm going to do this in TIP#166 http://purl.org/tcl/tip/166
    as I want more complete control than just "{} ==
    transparent" anyway.

  • Logged In: YES

    Thank you Donal.

    • summary: image put errors on "" color --> image put errors on {} color