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

画像を引き伸ばして塗りつぶす

引き伸ばして塗りつぶす

どのような処理ですか?

引き伸ばして塗りつぶす操作は、指定されたピクセル矩形を埋めるように画像を引き伸ばします。アスペクト比は保持されないため、画像は引き伸ばされ、指定された幅と高さになります。

JavaでBufferedImageを引き伸ばす

ImageProcessingOperations operations = new ImageProcessingOperations();

// ここでスケール、ぼかしなど、複数の操作を連結できます
operations.stretchToFill(100, 100); // 画像を100x100ピクセルのボックスに収まるようにする
        
// BufferedImageに操作を適用する
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);

引き伸ばして塗りつぶす操作のJavadocを表示

追加のコード例

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

Fileを使用する場合

File inputFile = new File("path/to/file");
File outputFile = new File("path/to/output-stretched-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);