Skip to main content
Interwork Corporation
IDR Solutions Product Support Portal
モードの切替 ダーク/ライト/自動 モードの切替 ダーク/ライト/自動 モードの切替 ダーク/ライト/自動

JDeliを使用したJavaでの画像処理

JDeli Java画像処理ライブラリは、画像ファイルまたはメモリ内の画像を処理することができます。複数の処理操作をconvertまたはprocessメソッドと組み合わせて適用することが可能です。

画像ファイルの処理

JDeli.convert(File inputFile, File outputFile, ImageProcessingOperations operations);

JDeliは、異なる画像ファイル形式間の変換も同時に行うことができます。

JDeli.convertのJavadocを見る

BufferedImageの処理

これは2つの方法で実行できます:

JDeliのprocessメソッドを使用する場合

image = JDeli.process(ImageProcessingOperations operations, BufferedImage image);

JDeli.processのJavadocを見る

または

ImageProcessingOperationsのapplyメソッドを使用する場合

image = operations.apply(BufferedImage image);

ImageProcessingOperationsクラス

このクラスは、複数の画像処理操作と、独自のカスタム操作を追加するためのインターフェースを提供します。複数の操作を追加でき、追加した順序で実行されます。

インスタンスを作成し、JDeliのprocessまたはconvertメソッドに渡します。

例1 - 処理操作のセットを作成する

ImageProcessingOperations operations = new ImageProcessingOperations();
operations.scale(1f);
operations.custom(new MyCustomProcess());
operations.rotate(90); //単位は度

例2 - 処理操作をチェーンする

ImageProcessingOperations operations = new ImageProcessingOperations()
.scale(1f)
.custom(new MyCustomProcess())
.rotate(90);

例3 - 操作の取り消しとやり直し

operations.undo(); // 最後に追加した操作を削除
operations.redo(); // 最後に削除した操作を再追加

例4 - カスタム操作の実装

private class MyCustomImageOperation implements ImageOperation {

    private Object myArgs;

    public MyCustomImageOperations(Object myArgs) {

        this.myArgs = myArgs;
    }

    @Override
    public BufferedImage apply(BufferedImage image) {

        //処理コードをここに記述
        return image;
    }
}

ImageProcessingOperations operations = 
new ImageProcessingOperations(new MyCustomImageOperation(myArgs));

processパッケージのJavadocを見る