< 戻る
印刷

画像のトリミング

どんな処理ができますか?

トリミング操作は、指定した矩形の位置、幅、高さで画像を切り取ります。

JavaでBufferedImageを使ったぼかし処理

				
					ImageProcessingOperations operations = new ImageProcessingOperations();

// ここでは、スケール、ぼかしなど、いくつかの操作を連鎖させることができます。
operations.crop(new Rectangle(10, 10, 100, 150)); // 位置10,10で100x150の矩形にトリミングします 

        
// BufferedImageへの操作の適用
BufferedImage modifiedImage = operations.apply(BufferedImage originalImage);
				
			

トリミング操作に関するJavadocを見る

その他のコード例

以下のコード例を使用して、画像フォーマットを処理および変換します:

Fileの使用
				
					File inputFile = new File("path/to/file");
File outputFile = new File("path/to/output-blurred-file");
JDeli.convert(inputFile, outputFile, operations);
				
			
InputStreamとOutputStreamの使用
				
					final InputStream inputStream = new FileInputStream(inputFile);
final OutputStream outputStream = new FileOutputStream(outputFile);
final String <a href="https://files.idrsolutions.com/maven/site/jdeli/apidocs/com/idrsolutions/image/encoder/OutputFormat.html" target="_blank" title="declaration: package: com.idrsolutions.image.encoder, enum: OutputFormat">outputFormat</a> = "format"; // 出力ファイルの形式(例:png、jpeg、...;
<a href="https://www.intwk.co.jp/jdeli/" title="Javaでイメージファイルを安全に扱うJDeliは、HEICやその他のイメージファイル形式をJavaで簡単に読み書き、変換、操作、処理できるようにするJava SDKです。HEIC画像の読み出し/書き込みJDeliは、開発者にHEIC画像フォーマットの包括的なサポートを提供します。また、JPEG/JPEG2000、PNG、TIFFファイルを含む他の画像フォーマットのサポートも強化されています重要なファイルを安全に保管" hreflang="ja" onover-preload="1">JDeli</a>.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);
				
			
MENU
PAGE TOP