Really Simple CAPTCHA
Transparent/alpha background + patch provided (4 posts)

  1. normadize
    Posted 2 years ago #

    Nowadays it is desired to have images with alpha (transparent background) and would be nice if Really Simple Captcha did the same for the PNG and GIF outputs.

    I hacked your code to achieve this, which is really easy. Just replace these lines:

    if ( $im = imagecreatetruecolor( $this->img_size[0], $this->img_size[1] ) ) {
        $bg = imagecolorallocate( $im, $this->bg[0], $this->bg[1], $this->bg[2] );

    with these:

    if ( $im = imagecreatetruecolor( $this->img_size[0], $this->img_size[1] ) ) {
        imagesavealpha($im, true);
        imagealphablending($im, false);
        $bg = imagecolorallocatealpha( $im, $this->bg[0], $this->bg[1], $this->bg[2], 127 );

    You can add the alpha value (4th param) to the class property. I didn't bother.

    Hope you'll implement it in the next version ... is there going to be a next version? The plugins page still says it's compatible up to WP 3.3.2, which is already ancient now.



  2. barnez
    Posted 2 years ago #

    Thanks for posting the code normadize, it works a treat and is just what I was looking for.

  3. fannur
    Posted 1 year ago #

    plugins -> editor -> Really Simple Captcha -> really-simple-captcha/really-simple-captcha.php

    /* Background color of CAPTCHA image. RGB color 0-255 */
    $this->bg = array( 255, 255, 255 );

    you can change it to bg color(rgb). hex to rgb converter

  4. normadize
    Posted 1 year ago #

    @fannur: the issue I posted about is how to make it transparent, not how to change the color.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Really Simple CAPTCHA
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic