1. Defining actions and commands
Gmoperation op = new Gmoperation ();
Graphicsmagickcmd cmd = new Graphicsmagickcmd ("Convert"); Convert shows that what you're going to do is convert the action inside
or convertcmd cmd = new Convertcmd (true); True indicates that you are using a GM tool
2. Parameter description for Scaling
op.resize (int width)//It writes width, which makes me think that I can limit the width, not actually, but to limit the length and width beyond width.
op.resize (int width, int height)//actually is equivalent to limit a box, picture and other proportions placed in the box
If you want to implement the picture in the box, but is filled with a box, which will appear stretched, then call
Op.resize (width, height, '! ');
3. Image format for input and output
"1" You already have a picture of the local, you just need to tell the original path and the path of the newly generated image after the transformation OK
Op.addimage (Srcpath);
Op.addimage (NewPath);
Cmd.run (OP);
Or
Op.addimage ();
Op.addimage ();
Cmd.run (Op,srcpath,srcpath);
So finish writing the picture processing module and finish it.
"2" Your original image is just an input stream, and your output image only wants an output stream
Op.addimage ("-"); Read from stdin
Op.addimage ("jpg:-"); Write to stdout in Jpg-format Note that the JPG here can be changed according to your image format, but you have to have it, otherwise you do not know you want to create the converted image in including style
Pipe Pipein = new pipe (is, null);
Pipe pipeout = new pipe (null, OS);
Cmd.setinputprovider (Pipein);
Cmd.setoutputconsumer (pipeout);
Cmd.run (OP);
So you can implement the picture output stream you want.
Using GraphicsMagick in Im4java