画像の拡大縮小
スケール操作は、double型で指定された拡大縮小率により画像をリサイズします。デフォルトで使用されるスケーリングオプションはAffineTransformOp.TYPE_BILINEARです。
ImageProcessingOperations operations = new ImageProcessingOperations();
// ここでは、拡大縮小、ぼかしなど、複数の操作を連鎖させることができます
operations.scale(1.2); //この場合、AffineTransformOp.TYPE_BILINEARが使用されます
//operations.scale(scalingFactor, AffineTransformOp.TYPE_BICUBIC); //AffineTransformOp.VALUE
// BufferedImageに操作を適用する
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
以下のコード例を使用して、画像フォーマット間の処理と変換を行います:
File inputFile = new File("path/to/file");
File outputFile = new File("path/to/output-scaled-file");
JDeli.convert(inputFile, outputFile, operations);
final InputStream inputStream = new FileInputStream(inputFile);
final OutputStream outputStream = new FileOutputStream(outputFile);
final String outputFormat = "format"; // 出力ファイルのフォーマット (例: png, jpeg,...)
JDeli.convert(inputStream, outputStream, outputFormat, operations);
byte[] inputData = Files.readAllBytes(Paths.get("/path/to/file"));
final String outputFormat = "format"; // 出力ファイルのフォーマット (例: png, jpeg,...)
byte[] outputData = JDeli.convert(inputData, outputFormat, operations);
