Title: Transparent/alpha background   patch provided
Last modified: August 20, 2016

---

# Transparent/alpha background patch provided

 *  [normadize](https://wordpress.org/support/users/normadize/)
 * (@normadize)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/transparentalpha-background-patch-provided/)
 * 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.
 * Cheers.
 * [http://wordpress.org/extend/plugins/really-simple-captcha/](http://wordpress.org/extend/plugins/really-simple-captcha/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [barnez](https://wordpress.org/support/users/pidengmor/)
 * (@pidengmor)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/transparentalpha-background-patch-provided/#post-3564017)
 * Thanks for posting the code normadize, it works a treat and is just what I was
   looking for.
 *  [fannur](https://wordpress.org/support/users/fannur/)
 * (@fannur)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/transparentalpha-background-patch-provided/#post-3564036)
 * 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](http://hex.colorrrs.com/)
 *  Thread Starter [normadize](https://wordpress.org/support/users/normadize/)
 * (@normadize)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/transparentalpha-background-patch-provided/#post-3564037)
 * [@fannur](https://wordpress.org/support/users/fannur/): the issue I posted about
   is how to make it transparent, not how to change the color.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Transparent/alpha background patch provided’ is closed to new replies.

 * ![](https://ps.w.org/really-simple-captcha/assets/icon-256x256.png?rev=1047241)
 * [Really Simple CAPTCHA](https://wordpress.org/plugins/really-simple-captcha/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/really-simple-captcha/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/really-simple-captcha/)
 * [Active Topics](https://wordpress.org/support/plugin/really-simple-captcha/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/really-simple-captcha/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/really-simple-captcha/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [normadize](https://wordpress.org/support/users/normadize/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/transparentalpha-background-patch-provided/#post-3564037)
 * Status: not resolved