开发者

Cropping an image in any shape

开发者 https://www.devze.com 2022-12-09 01:00 出处:网络
Crop an image by mouse draging shape. not in rectangle shape. If I am click and drag the mouse in a particular shape crop image开发者_如何学编程 in that shapeYour final image can obviously only be a r

Crop an image by mouse draging shape. not in rectangle shape. If I am click and drag the mouse in a particular shape crop image开发者_如何学编程 in that shape


Your final image can obviously only be a rectangle and have a height and width.

You would need to keep coordinates of the shape you "draw/drag" and then somehow use this as a mask to set the pixels outside this area to a specific "empty/background" colour or transparent if the image type supports it.

Does this answer your question?


this might help you:

Image img = Imager.Crop(sourceImage, new Rectangle(x, y, width, height));

http://imager.codeplex.com/

instead of new Rectangle you do something else

0

精彩评论

暂无评论...
验证码 换一张
取 消