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

カスタム操作

何をするものか?

カスタム操作を使用すると、独自のカスタム画像処理操作コードを追加できます。

カスタム画像処理操作を適用する例

private class MyCustomImageOperation implements ImageOperation {

    private Object myArgs;

    public MyCustomImageOperations(Object myArgs) {

        this.myArgs = myArgs;
    }

    @Override
    public BufferedImage apply(BufferedImage image) {

        //process code here
        return image;
    }
}
ImageProcessingOperations operations = new ImageProcessingOperations();

// scale、blurなどの複数の操作をチェーンできます
operations.custom(new MyCustomImageOperations()); 
        
// BufferedImageに操作を適用します
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);

追加のコード例

以下のコード例を使用して、画像フォーマット間の処理と変換を行います:

Fileを使用する場合

File inputFile = new File("path/to/file");
File outputFile = new File("path/to/output-custom-file");
JDeli.convert(inputFile, outputFile, operations);

InputStreamとOutputSteamを使用する場合

final InputStream inputStream = new FileInputStream(inputFile);
final OutputStream outputStream = new FileOutputStream(outputFile);
final String outputFormat = "format"; // format of the output file eg. png, jpeg,...;
JDeli.convert(inputStream, outputStream, outputFormat, operations);

byte[]を使用する場合

byte[] inputData = Files.readAllBytes(Paths.get("/path/to/file"));
final String outputFormat = "format"; // format of the output file eg. png, jpeg,...;
byte[] outputData = JDeli.convert(inputData, outputFormat, operations);

カスタム操作のJavadocを表示