如何裁剪放大的图像(放大/缩小) [英] How to crop an image that is zoomed(zoomed in/out)

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

问题描述

如何裁剪放大(放大/缩小)的图像.当图像正常但未缩放时,裁切效果很好.我使用了一个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.

推荐答案

...

用于缩放和平移的WPF自定义控件 [ ^ ]


请参考上面的链接.

从我的角度来看,解决您问题的方法就像>>

选择要裁剪的矩形.然后保存裁剪后的图像

然后根据您的要求调整缩放比例(缩放百分比).

在裁切和调整大小方面,我想我可以提供帮助.
from my point of view...

A WPF Custom Control for Zooming and Panning[^]


please refer the above link.

solution to you problem from my view would be like >>

select the rectangle to crop. then save the cropped image

then resize the iamage as per your requirement(zoom percent).

in croping and resizing i guess i can help.


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆