Changing The Size Of An Image.
First off, I would just like to say that i�m a French Canadian student so my English is not very good, and that I�m not an expert in JMagick so this might not be the best way to do it. If there is a better way your welcome to send it to me and I will make correction to this document.
One very useful feature of ImageMagick is to be able to resize images. This function is great for creating thumbnails or for making full screen images. It might seem a little complex at first but manipulating images with JMagick is a very simple and powerful thing.
Step 1: Reading The Picture Files
ImageInfo info = new ImageInfo(); MagickImage image = new MagickImage( new ImageInfo( "testpic.jpg" ) );
For more information on reading pictures look at the previous tutorials.
Step 2: Resizing
MagickImage bigger = image.scaleImage(1200, 900);
As you can see this is pretty straightforward, you use your already existing instance of
MagickImage that we named image use the scaleImage method with the desired width(1200)
and height(900). The method returns a MagickImage object witch is the new resized image.
Step 3: Writing the new file
bigger.setFileName("bigger.jpg"); bigger.writeImage(info);
All that is left to do is to create a new file in this case its called bigger.jpg but we could have also overwritten testpic.jpg