I imported a picture onto another picture and I am wondering how to get rid of the white around the smaller picture.

We'll need mode details
How do you import a picture into another picture ?

I didn't import the picture INTO the picture I just imported it onto the picture. Anyway here is my script right now. Also I cannot seem to get the backbuffer working.

// The "GreenScreen" class.
import java.applet.*;
import java.awt.*;

public class GreenScreen extends Applet
    Image img, backbuffer;
    Graphics backg;

    // Place instance variables here

    public void init ()

        //img = getImage (getDocumentBase(), "bug1right.jpg");
        //backg = getImage (getDocumentBase(), "hedge.jpg");
        img = getImage (getDocumentBase (), "bug1right.gif");
        backbuffer = getImage (getDocumentBase (), "hedgelarge.gif");

        backbuffer = createImage (100, 100);
        backg = backbuffer.getGraphics ();
        backg.setColor (Color.white);
        // Place the body of the initialization method here
    } // init method

    public void paint (Graphics g)
        g.drawImage (backbuffer, 0, 0, this);
        g.drawImage (img, 10, 10, 50, 50, this);
        // Place the body of the drawing method here
    } // paint method
} // GreenScreen class

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

I figured out how to fix it. thanks for the help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.