Method 2. Here what I've done is take the original B&W mask from the first image, and paste it into my original Photoshop working image as a new channel. I throw away all the other channels, and I'll use this as my 'alpha mask' for transparency.
Now open the background you're going to use on the web page, "select all", and choose "edit/define pattern". Close the image, and choose the create a new layer at the bottom of your working file. Choose "edit/fill", selecting "pattern", 100%, and "normal". Now your shadow falls over the background, and when you save the file, specifying "use alpha mask" for the transparency, it will clip the file along that mask. Remember to save this file with a new name, don't over-write your working file!
This method doesn't work with every background, if your background has some radically different colors in it this method may not work for you. Here's a screen capture, just before I dropped down to "indexed color" and exported my file as GIF89a, selecting the "Transparency" layer instead of "Select Colors". |