Java 2D - Resizing BufferedImage

I need to resize a BufferedImage that is of very high quality. The picture is as much as 8Mb, and that’s why I want to downsize it before saving in my DB. Anyway, my routine workd fine on smaller pictures, but when the picture gets this big, it simply stops. Anyone knows a better way of resizing pictures?

My code is:

BufferedImage img = ImageIO.read(picFile);
Image tmpimg = img.getScaledInstance(-1, 70, 0);
JLabel lbl = new JLabel(”");
loadImage(tmpimg, lbl);
int w = tmpimg.getWidth(null);
int h = tmpimg.getHeight(null);
BufferedImage bi = new BufferedImage(w, h, BuffferedImage.TYPE_INT_RGB);
Graphics2D g2d = bi.createGraphics();
g2d.drawImage(tmpimg, 0,0, w, h, null);
g2d.dispose();

Then the bi should be right size, which it is normally, just that such large pictures stops the whole application. I have set -Xmx512m, and have a pretty good PC (1Gb+ RAM).

And the loadImage function is: Read the rest of this entry »

Social Bookmarking: Ins and Outs

What Is Social Bookmarking?

If you are an avid surfer of the ocean called the Internet, you will frequently come across some really interesting links that you might want your friends to know about. There are some websites that allow you store these links, tag them, and label them for public or private viewing. This is known as social bookmarking. People who visit these websites can access these links. These websites provide the space to store, organize, and access the links of other websites. People search for resources on the social bookmarking sites via public bookmarks, tags, and classifications that have been created and saved by the users of the social bookmarking sites. Examples of social bookmarking sites are del.icio.us and Stumbleupon.

Read the rest of this entry »

 

Subscribe Using Email

Follow us on twitter