And I presume that bug1right.gif has a white frame ?
Not an easy task.
If it is the case, not an easy task, you can make a BufferedImage out of it
Then by getRgb() method you can get an double dimension array of all the pixels in your image. The array will be a int[imageWidth][imageHeight]
You can then make 2 nested loop to inspect the pixels on the border. If the color is +/- white (something like red > 240, green > 240, blue > 240) you can set the alpha to 255 for these pixels.
Then you can rebuild and Image of TYPE_4BYTES_ABGR (Alpha, Reg, Green, Blue)
If the frame if perfectly rectangular you can just search where the color change from left to right and top to bottom and just draw the subImage