簡體   English   中英

如何在Java中的特定位置創建具有特定高度和寬度的圖像文件

[英]How to create image file in specific location with particular height and width in java

我正在實施從圖像中檢測矩形對象的項目。 我想將該部分存儲到內存中。 由於每次獲取的高度和寬度都是不可預測的,因此我無法通過在sd卡上創建將完全占據矩形對象的圖像文件來獲取如何存儲矩陣的那部分

我如何創建圖像,例如。 // temp /中的demo.jpg,大小為90x50

使用php GD函數。 使用如下代碼

header ('Content-Type: image/png');
$im = @imagecreatetruecolor(120, 20)
  or die('Cannot Initialize new GD image stream');
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);
imagepng($im);
imagedestroy($im);

http://php.net/manual/en/function.set-error-handler.php獲取幫助

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM