package Image;
import java.io.*;
import javax.imageio.ImageIO;
import java.awt.Frame;
import java.awt.image.renderable.ParameterBlock;
import java.io.IOException;
import javax.media.jai.Interpolation;
import javax.media.jai.JAI;
import javax.media.jai.RenderedOp;
import com.sun.media.jai.codec.FileSeekableStream;
import javax.media.jai.widget.ScrollingImagePanel;
/**
* This program decodes an image file of any JAI supported
* formats, such as GIF, JPEG, TIFF, BMP, PNM, PNG, into a
* RenderedImage, scales the image by 2X with bilinear
* interpolation, and then displays the result of the scale
* operation.
*/
public class JAISampleProgram {
/** The main method. */
public static void main(String[] args) throws FileNotFoundException {
String input = "C:/a/01.jpg";
String output = "C:/a/nuovo.jpg";
RenderedOp image1 = JAI.create("fileload", input);
/*
* Create a standard bilinear interpolation object to be
* used with the “scale” operator.
*/
Interpolation interp = Interpolation.getInstance(
Interpolation.INTERP_BILINEAR);
/**
* Stores the required input source and parameters in a
* ParameterBlock to be sent to the operation registry,
* and eventually to the “scale” operator.
*/
ParameterBlock params = new ParameterBlock();
params.addSource(image1);
params.add(2.0F); // x scale factor
params.add(2.0F); // y scale factor
params.add(0.0F); // x translate
params.add(0.0F); // y translate
params.add(interp); // interpolation method
/* Create an operator to scale image1. */
RenderedOp image2 = JAI.create("scale", params);
/* Get the width and height of image2. */
int width = image2.getWidth();
int height = image2.getHeight();
FileOutputStream stream1 = new FileOutputStream(output);
JAI.create("filestore", image2, output, "JPEG", null);
}
}
Non c'è niente da fare, non riesco a cambiare la risoluzione di questa dannata immagine. Qualcuno mi può aiutare? sono disperato!