diff -ur swftools-2009-08-24-2042-orig/src/swfextract.c swftools-2009-08-24-2042/src/swfextract.c
--- swftools-2009-08-24-2042-orig/src/swfextract.c	2009-01-27 12:18:37.000000000 -0500
+++ swftools-2009-08-24-2042/src/swfextract.c	2009-11-30 14:29:50.000000000 -0500
@@ -34,6 +34,7 @@
 
 char * filename = 0;
 char * destfilename = "output.swf";
+char * destalpha = 0;
 int verbose = 3;
 
 char* extractids = 0;
@@ -55,6 +56,7 @@
 struct options_t options[] =
 {
  {"o","output"},
+ {"a","alpha"},
  {"w","hollow"},
  {"v","verbose"},
  {"i","id"},
@@ -71,6 +73,14 @@
  {0,0}
 };
 
+// forward declarations
+static void make_crc32_table(void);
+static void png_start_chunk(FILE*fi, char*type, int len);
+static inline void png_write_byte(FILE*fi, U8 byte);
+static void png_write_bytes(FILE*fi, U8*bytes, int len);
+static void png_write_dword(FILE*fi, U32 dword);
+static void png_end_chunk(FILE*fi);
+
 
 int args_callback_option(char*name,char*val)
 {
@@ -82,6 +92,10 @@
 	destfilename = val;
 	return 1;
     } 
+    else if(!strcmp(name, "a")) {
+	destalpha = val;
+	return 1;
+    } 
     else if(!strcmp(name, "i")) {
 	extractids = val;
 	numextracts++;
@@ -194,6 +208,7 @@
     printf("\t-F , --font ID\t\t\t Extract font(s)\n");
     printf("Picture extraction:\n");
     printf("\t-j , --jpeg ID\t\t\t Extract JPEG picture(s)\n");
+    printf("\t-a , --alpha filename\t\t\t Extract JPEG alpha channel to specified PNG file\n");
 #ifdef _ZLIB_INCLUDED_
     printf("\t-p , --pngs ID\t\t\t Extract PNG picture(s)\n");
 #endif
@@ -686,6 +701,79 @@
             fwrite(&tag->data[pos+4], end-(pos+4), 1, fi);
             fclose(fi);
         }
+
+	if (end < tag->len && destalpha) {
+
+	    make_crc32_table();
+	    // Bytes from end to tag->len are zlib compressed alpha
+
+	    int width, height;
+	    swf_GetJPEGSize(filename, &width, &height);
+	    msg("<verbose> alpha size will be w=%d, height=%d", width, height);
+
+	    // Decompress data
+	    uLongf datalen = (width*height);
+	    Bytef *data = malloc(datalen);
+	    int error = uncompress (data, &datalen, &tag->data[end], tag->len-end);
+	    if(error != Z_OK) {
+	      fprintf(stderr, "Zlib error %d\n", error);
+	      return;
+	    }
+	    msg("<verbose> Uncompressed alpha is %d bytes", datalen);
+
+	    // "data" is now the uncompressed alpha data
+
+	    // PNG header
+	    fi = save_fopen(destalpha, "wb");
+	    U8 head[] = {137,80,78,71,13,10,26,10};
+	    fwrite(head,sizeof(head),1,fi);     
+
+	    png_start_chunk(fi, "IHDR", 13);
+	    png_write_dword(fi,width);
+	    png_write_dword(fi,height);
+	    png_write_byte(fi,8); //8bpp
+	    png_write_byte(fi,0); //grayscale
+	    png_write_byte(fi,0); //compression mode
+	    png_write_byte(fi,0); //filter mode
+	    png_write_byte(fi,0); //interlace mode
+	    png_end_chunk(fi);
+   
+	    uLongf datalen2 = (width + 1) * height;
+	    Bytef *data2 = malloc(datalen2);
+	    uLongf datapos2 = 0;
+	    int y;
+	    for (y=0; y < height; ++y) {
+	      data2[datapos2] = 0; // no filter
+	      memcpy(&data2[datapos2+1], &data[y * width], width);
+	      datapos2 += width + 1;
+	    }
+
+	    free(data);
+
+	    // "data2" is now the uncompressed alpha data with PNG stripes
+
+	    uLongf datalen3 = datalen2 + 200;
+	    Bytef *data3 = malloc(datalen3);
+
+	    if(compress (data3, &datalen3, data2, datalen2) != Z_OK) {
+	      fprintf(stderr, "zlib error compressing\n");
+	      return;
+	    }
+	    free(data2);
+
+	    // "data3" is now the compressed PNG alpha data
+
+	    msg("<verbose> Compressed alpha data is %d bytes", datalen3);
+	    png_start_chunk(fi, "IDAT", datalen3);
+	    png_write_bytes(fi,data3,datalen3);
+	    png_end_chunk(fi);
+	    png_start_chunk(fi, "IEND", 0);
+	    png_end_chunk(fi);
+
+	    free(data3);
+
+	    fclose(fi);
+	}
     }
     else {
 	int id = GET16(tag->data);
