How to Double Image Size

Use the following code to scale an image into double its original size:

import java.applet.*;import java.awt.*;import java.net.*;public class ScaleImage extends Applet{    Image img;    public void init()    {        try        {            img = getImage (new URL(getDocumentBase(),flo.jpg));        }catch (MalformedURLException e)       {       	 System.out.println(URL not valid:+e);        }    }    public void paint (Graphics g)    {        g.drawImage(img,0,0,img.getWidth(null)*2,img.getHeight(null)*2,this);    }}/**/
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: