How do I resize a .jpg file using Java? For example, I'd like to double the width and height of an image.
Asked
Active
Viewed 305 times
-5
-
Check out the Image API. There is a method that will allow you to scale the image. – camickr May 07 '13 at 03:37
-
1You could look at [this](http://stackoverflow.com/questions/14115950/quality-of-image-after-resize-very-low-java/14116752#14116752) or [this](http://stackoverflow.com/questions/12876615/how-do-i-resize-images-inside-an-application-when-the-application-window-is-resi/12876799#12876799) or [this](http://stackoverflow.com/questions/11959758/java-maintaining-aspect-ratio-of-jpanel-background-image/11959928#11959928) as just a few examples, and many more on SO if you did a quick search... – MadProgrammer May 07 '13 at 03:38
1 Answers
1
You can use the method getScaledInstance
from Image
. For more information see the Documentation

fbafelipe
- 4,862
- 2
- 25
- 40
-
1`getScaledInstance` isn't necessarily the best choice, check out [The Perils of Image.getScaledInstance()](https://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html) – MadProgrammer May 07 '13 at 03:40