This how-to demonstrates how to resize an image using Java and Marvin.

First, use static import for MarvinPluginCollection class to have access to its static methods directly on your class.


import static marvin.MarvinPluginCollection.*;

Just use the method scale(...) for scalling images.

MarvinImage image = MarvinImageIO.loadImage("myimage.jpg");
scale(image.clone(), image, 500, 400); // 500 and 400 are the new width and height.
MarvinImageIO.saveImage(image, "myimage_scaled.jpg");

Was this how-to helpful? Share it:

Do not you know how to setup Marvin? Read how to develop your First Application.