本文介绍了如何裁剪放大的图像(放大/缩小)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何裁剪放大(放大/缩小)的图像.当图像正常但未缩放时,裁切效果很好.我使用了一个AutoScroll属性为true的面板,以及它的sizemode属性为AutoSize和BackgroundImageLayout为Tile的面板中的图片框.

载入图片:

How to crop an image that is zoomed(zoomed in/out). Cropping works fine when the image is normal, that is not zoomed. I have used a panel whose AutoScroll property is true and a picturebox inside the panel whose sizemode property is AutoSize and BackgroundImageLayout is Tile.

Load image:

Image img = Image.FromFile("filepath");
picBoxImageProcessing.Image = img;



放大:



zoom in:

 zoomFactor += 1;
 picBoxImageProcessing.Size = new  Size((img.Width * zoomFactor), (img.Height * zoomFactor));
picBoxImageProcessing.SizeMode = PictureBoxSizeMode.StretchImage;



裁剪:
在图像上绘制一个矩形,然后进行裁剪.



cropping:
Draw a rectangular shape on the image and then crop.

Crop(Image img, Rectangle r)
{
//
}



这样,当我先放大然后选择一个特定区域时,在缩放的图像上绘制一个矩形,然后进行裁切,然后裁切另一个区域,而不是选择了我.
我有很多图像处理应用程序,但无法解决我的问题.

在此先感谢您.



In this way when i zoom in first and then select a specific region drawing a rectangle on the zoomed image and then crop then another region is cropped rather than i have selected.
I have got many application for image processing but I couldn''t solve my problem.

thanks in advance.

推荐答案


这篇关于如何裁剪放大的图像(放大/缩小)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-12 12:24