How to resize/rescale an image in Java

How would I resize a Java Image so that its size would be 1000 by 1000 px. It would be cool if it's like 1-3 lines of code. Thanks!

Answers


Try this. It works for me:

Image yourResizedImage = yourImage.getScaledInstance(YOUR_WIDTH, YOUR_HEIGHT,  java.awt.Image.SCALE_SMOOTH) ;  

Need Your Help

How to Regex search/replace only first occurrence in a string in .NET?

.net regex

It seems the .NET Regex.Replace method automatically replaces all matching occurrences. I could provide a MatchEvaluator delegate that returns the matched string after the first replacement, rende...

Restrict keyboard short-cuts in x11vnc

vnc vnc-server

How can I restrict keyboard shortcut options in x11vnc?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.