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

画像を反転する

何をするものか?

ミラー操作は画像を反転するために使用できます。画像は水平方向または垂直方向に反転されます。

JavaでBufferedImageを反転する

ImageProcessingOperations operations = new ImageProcessingOperations();

// ここでスケール、ブラーなど、いくつかの操作をチェーンできます
operations.mirror(MirrorOperations.HORIZONTAL); // MirrorOperationsを使用して、使用するミラー操作を指定します
        
// BufferedImageに操作を適用します
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);

ミラー操作のJavadocを表示

その他のコード例

以下のコード例を使用して、画像形式間の処理と変換を行います:

Fileを使用する場合

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

InputStreamとOutputSteamを使用する場合

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[]を使用する場合

byte[] inputData = Files.readAllBytes(Paths.get("/path/to/file"));
final String outputFormat = "format"; // 出力ファイルの形式 例: png, jpeg,...;
byte[] outputData = JDeli.convert(inputData, outputFormat, operations);