#40601 [NEW]: imagesavealpha() has opposite effect on transparent color

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #40601 [NEW]: imagesavealpha() has opposite effect on transparent color

    From: seth at pricepages dot org
    Operating system: Mac 10.4
    PHP version: 5.2.1
    PHP Bug Type: GD related
    Bug description: imagesavealpha() has opposite effect on transparent color

    Description:
    ------------
    The function imagesavealpha() has an opposite effect on the
    output image if the color is marked as transparent. For
    example, the code below should always create a clear image.
    But it renders as black.

    The interesting thing is that if you remove the imagesavealpha
    , the image renders as expected (clear).

    Reproduce code:
    ---------------
    <?php
    $img = imagecreatetruecolor(100,100);

    $trans = imagecolorresolve($img,0,0,0);
    imagecolortransparent($img, $trans);
    imagealphablending($img, false);
    imagefilledrectangle($img, 0,0, 100,100, $trans);

    //Has opposite affect
    imagesavealpha($img,true);

    header('Content-Type: image/png');
    imagepng($img);
    ?>

    Expected result:
    ----------------
    nothing (a clear image)

    Actual result:
    --------------
    a solid black image

    --
    Edit bug report at [url]http://bugs.php.net/?id=40601&edit=1[/url]
    --
    Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=40601&r=trysnapshot44[/url]
    Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=40601&r=trysnapshot52[/url]
    Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=40601&r=trysnapshot60[/url]
    Fixed in CVS: [url]http://bugs.php.net/fix.php?id=40601&r=fixedcvs[/url]
    Fixed in release: [url]http://bugs.php.net/fix.php?id=40601&r=alreadyfixed[/url]
    Need backtrace: [url]http://bugs.php.net/fix.php?id=40601&r=needtrace[/url]
    Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=40601&r=needscript[/url]
    Try newer version: [url]http://bugs.php.net/fix.php?id=40601&r=oldversion[/url]
    Not developer issue: [url]http://bugs.php.net/fix.php?id=40601&r=support[/url]
    Expected behavior: [url]http://bugs.php.net/fix.php?id=40601&r=notwrong[/url]
    Not enough info: [url]http://bugs.php.net/fix.php?id=40601&r=notenoughinfo[/url]
    Submitted twice: [url]http://bugs.php.net/fix.php?id=40601&r=submittedtwice[/url]
    register_globals: [url]http://bugs.php.net/fix.php?id=40601&r=globals[/url]
    PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=40601&r=php3[/url]
    Daylight Savings: [url]http://bugs.php.net/fix.php?id=40601&r=dst[/url]
    IIS Stability: [url]http://bugs.php.net/fix.php?id=40601&r=isapi[/url]
    Install GNU Sed: [url]http://bugs.php.net/fix.php?id=40601&r=gnused[/url]
    Floating point limitations: [url]http://bugs.php.net/fix.php?id=40601&r=float[/url]
    No Zend Extensions: [url]http://bugs.php.net/fix.php?id=40601&r=nozend[/url]
    MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=40601&r=mysqlcfg[/url]
    seth at pricepages dot org Guest

  2. Similar Questions and Discussions

    1. How do I make a box a transparent or opaque color
      I want to create a box to identify a spot on an aerial map, but I want the color box to be somewhat transparent. In photoshop I can control the...
    2. Transparent areas show up as off color
      When I export an InDesign document to PDF (Acrobat 6) and then print on a color printer, the transparent areas show up as a slightly different color....
    3. Color to Transparent Gradient
      Hello, can you tell me how can I make a gradient like in Photoshop from a normal 100% opacity color to transparent. Thanx
    4. Transparent to color gradient for a photo
      I've just started trying to learn InDesign. I have a photo in a project that I want the right side to blend into a solid color. I've tried to create...
    5. can i make an effect the opposite of a mask?
      In my game I'm trying to make a 'fog of war' type of effect. The way I want to do it is have a shape that cuts out a peice of a black rectangle. ...
  3. #2

    Default #40601 [Opn->Bgs]: imagesavealpha() has opposite effect on transparent color

    ID: 40601
    Updated by: [email]pajoye@php.net[/email]
    Reported By: seth at pricepages dot org
    -Status: Open
    +Status: Bogus
    Bug Type: GD related
    Operating System: Mac 10.4
    PHP Version: 5.2.1
    -Assigned To:
    +Assigned To: pajoye
    New Comment:

    Transparent color and alpha cannot work together when you save a file.
    PNG supports one or another not both (PNG is also the only format
    supporting alpha).

    You will get a warning/error in libpng if you try to do the same calls
    (for example in C).

    not a bug > bogus.



    Previous Comments:
    ------------------------------------------------------------------------

    [2007-02-23 03:04:57] seth at pricepages dot org

    Description:
    ------------
    The function imagesavealpha() has an opposite effect on the
    output image if the color is marked as transparent. For
    example, the code below should always create a clear image.
    But it renders as black.

    The interesting thing is that if you remove the imagesavealpha
    , the image renders as expected (clear).

    Reproduce code:
    ---------------
    <?php
    $img = imagecreatetruecolor(100,100);

    $trans = imagecolorresolve($img,0,0,0);
    imagecolortransparent($img, $trans);
    imagealphablending($img, false);
    imagefilledrectangle($img, 0,0, 100,100, $trans);

    //Has opposite affect
    imagesavealpha($img,true);

    header('Content-Type: image/png');
    imagepng($img);
    ?>

    Expected result:
    ----------------
    nothing (a clear image)

    Actual result:
    --------------
    a solid black image


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40601&edit=1[/url]
    pajoye@php.net Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139