Only in image_captcha: CVS
Common subdirectories: image_captcha/fonts and new_image_captcha/fonts
diff -up image_captcha/image_captcha.admin.inc new_image_captcha/image_captcha.admin.inc
--- image_captcha/image_captcha.admin.inc	2009-09-18 01:16:32.000000000 +0200
+++ new_image_captcha/image_captcha.admin.inc	2009-09-19 19:01:15.875000000 +0200
@@ -138,16 +138,27 @@ function image_captcha_settings_form() {
     ),
   );
 
-    // color settings
+    // color and image settings
   $form['image_captcha_color_settings'] = array(
     '#type' => 'fieldset',
-    '#title' => t('Color settings'),
-    '#description' => t('Configuration of the background and text colors in the image CAPTCHA.'),
+    '#title' => t('Color and image settings'),
+    '#description' => t('Configuration of the image format, background and text colors in the image CAPTCHA.'),
+  );
+  $form['image_captcha_color_settings']['image_captcha_image_format'] = array(
+    '#type' => 'select',
+    '#title' => t('Image format'),
+    '#description' => t('Select image type, JPEG or PNG.'),
+    '#default_value' => variable_get('image_captcha_image_format', 1),
+    '#options' => array(
+      1 => 'JPEG',
+	  2 => 'PNG',
+	  3 => 'PNG - ' . t('transparent background'),
+    ),
   );
   $form['image_captcha_color_settings']['image_captcha_background_color'] = array(
     '#type' => 'textfield',
     '#title' => t('Background color'),
-    '#description' => t('Enter the hexadecimal code for the background color (e.g. #FFF or #FFCE90).'),
+    '#description' => t('Enter the hexadecimal code for the background color (e.g. #FFF or #FFCE90).<br/> For png-transparent-background best result set it close to the underlying background color. '),
     '#default_value' => variable_get('image_captcha_background_color', '#ffffff'),
     '#maxlength' => 7,
     '#size' => 8,
diff -up image_captcha/image_captcha.module new_image_captcha/image_captcha.module
--- image_captcha/image_captcha.module	2009-09-18 00:58:43.000000000 +0200
+++ new_image_captcha/image_captcha.module	2009-09-19 19:15:08.531250000 +0200
@@ -18,6 +18,10 @@ define('IMAGE_CAPTCHA_ERROR_NO_GDLIB_WIT
 define('IMAGE_CAPTCHA_ERROR_NO_TTF_SUPPORT', 2);
 define('IMAGE_CAPTCHA_ERROR_TTF_FILE_READ_PROBLEM', 4);
 
+define('IMAGE_CAPTCHA_FILE_FORMAT_JPG', 1);
+define('IMAGE_CAPTCHA_FILE_FORMAT_PNG', 2);
+define('IMAGE_CAPTCHA_FILE_FORMAT_TRANSPARENT_PNG', 3);
+
 
 /**
  * Implementation of hook_help().
diff -up image_captcha/image_captcha.user.inc new_image_captcha/image_captcha.user.inc
--- image_captcha/image_captcha.user.inc	2009-09-18 01:16:32.000000000 +0200
+++ new_image_captcha/image_captcha.user.inc	2009-09-19 18:19:46.625000000 +0200
@@ -1,5 +1,5 @@
 <?php
-// $Id: image_captcha.user.inc,v 1.20 2009/09/17 23:16:32 soxofaan Exp $
+// $Id: image_captcha.user.inc,v 1.20-x 2009/09/19 13:16:00 soxofaan Exp $
 
 /**
  * @file
@@ -29,16 +29,30 @@ function image_captcha_image($captcha_si
       watchdog('CAPTCHA', 'Generation of image CAPTCHA failed. Check your image CAPTCHA configuration and especially the used font.', array(), WATCHDOG_ERROR);
       exit();
     }
-    // Send the image resource as an image to the client
-    drupal_set_header("Content-type: image/jpeg");
-    // Following header is needed for Konqueror, which would re-request the image
-    // on a mouseover event, which failes because the image can only be generated
-    // once. This cache directive forces Konqueror to use cache instead of
-    // re-requesting
-    drupal_set_header("Cache-Control: max-age=3600, must-revalidate");
-    // print the image as jpg to the client
-    imagejpeg($image);
-    // Clean up
+    // Check image type and Send the image resource as an image to the client
+	$img_type = variable_get('image_captcha_image_format', 1);
+	if ($img_type == IMAGE_CAPTCHA_FILE_FORMAT_JPG) {
+	  // Send the image resource as an image to the client
+	  drupal_set_header("Content-type: image/jpeg");
+      // Following header is needed for Konqueror, which would re-request the image
+      // on a mouseover event, which failes because the image can only be generated
+      // once. This cache directive forces Konqueror to use cache instead of
+      // re-requesting	  
+	  drupal_set_header("Cache-Control: max-age=3600, must-revalidate");
+	  // print the image as jpg to the client
+	  imagejpeg($image);
+    }
+    else {
+ 	  // Send the image resource as an image to the client
+      drupal_set_header("Content-type: image/png"); 
+      // Following header is needed for Konqueror, which would re-request the image
+      // on a mouseover event, which failes because the image can only be generated
+      // once. This cache directive forces Konqueror to use cache instead of
+      // re-requesting	  
+	  drupal_set_header("Cache-Control: max-age=3600, must-revalidate");
+	  // print the image as png to the client
+      imagepng($image);
+	}
     imagedestroy($image);
   }
   exit();
@@ -87,8 +101,12 @@ function _image_captcha_generate_image($
   }
 
   // get background color and paint
+  $img_type = variable_get('image_captcha_image_format', 1);
   $background_rgb = _image_captcha_hex_to_rgb(variable_get('image_captcha_background_color', '#ffffff'));
   $background_color = imagecolorallocate($image, $background_rgb[0], $background_rgb[1], $background_rgb[2]);
+  if ($img_type == IMAGE_CAPTCHA_FILE_FORMAT_TRANSPARENT_PNG) {
+    imagecolortransparent($image, $background_color);   
+  }
   imagefilledrectangle($image, 0, 0, $width, $height, $background_color);
 
   // draw text
@@ -124,6 +142,9 @@ function _image_captcha_generate_image($
     $freq_yt = 2 * 3.141592 / $wavelength_yt;
 
     $distorted_image = imagecreatetruecolor($width, $height);
+    if ($img_type == IMAGE_CAPTCHA_FILE_FORMAT_TRANSPARENT_PNG) {
+      imagecolortransparent($distorted_image, $background_color);   
+    }
     if (!$distorted_image) {
       return FALSE;
     }
