0
A
回答
3
我提出以下方法:
- 讀取輸入圖像保存原始大小
- 刪除使用
trim
- 拉伸(現在更小)圖像的透明*區域到原來的大小
*如果樣本圖片中的黃色區域實際上是透明的,您可以在以下代碼中輸入fuzz = 0
,否則您必須調整值e確保刪除所有不需要的區域。
string srcImageFullPath = "c:\input.png";
int fuzz = 0;
string destImageFullPath = "c:\output.png";
// Read image from file
using (MagickImage image = new MagickImage(srcImageFullPath))
{
//save height/width of the original image
int height = image.Page.Height;
int width = image.Page.Width;
//set fuzz percentage
image.ColorFuzz = new ImageMagick.Percentage(fuzz);
//trim borders
image.Trim();
//resize image to original size
MagickGeometry size = new MagickGeometry(width, height);
size.IgnoreAspectRatio = true;
image.Resize(size);
// Save the result
image.Write(destImageFullPath);
}
在下面的圖片你可以調整右側後看到左邊的原始圖像,並且圖像:
注
相關問題
- 1. 使圖像背景透明
- 2. 透明背景透明圖像問題
- 3. 使用PHP png圖像透明背景
- 4. 圖像背景透明GIMP
- 5. 如何使用透明圖像作爲透明winform的背景?
- 6. 使背景圖像半透明
- 7. 使圖像透明在IE中顯示非透明背景
- 8. 試圖添加背景圖像透明度不透明
- 9. Matplotlib在圖像透明填充
- 10. 在Photoshop上透明背景圖像
- 11. 將背景添加到透明圖像
- 12. 透明Jbutton將與背景圖像
- 13. 調整圖像大小,透明背景?
- 14. 可可NSStatusItem圖像 - 不透明背景
- 15. Tkinter - 按鈕圖像透明背景
- 16. 背景圖像,但與不透明css
- 17. HTML/CSS/jQuery:背景圖像不透明
- 18. 分組的UITableViewCell透明背景圖像
- 19. 透明PNG作爲背景圖像
- 20. 背景上的Android PNG透明圖像
- 21. css透明圖像的背景顏色
- 22. 帶有透明背景的圖像Launchscreen.storyboard
- 23. PyQt透明背景圖像部分黑
- 24. Android透明部件背景圖像
- 25. CoreGraphics中:圖像透明背景
- 26. 透明圖像背景HTML5畫布
- 27. 使用Magick.NET調整透明圖像的大小
- 28. CSS:背景圖像和填充
- 29. 動畫從圖像中填充背景
- 30. 透明背景
因此,圖像中的黃色區域實際上不是黃色,而是透明的? – Andrea