0
A
回答
1
我已经通过Jquery获取了图像部分的坐标。
jQuery(function($) {
$('#target').Jcrop({
onChange: showCoords,
onSelect: showCoords,
onRelease: clearCoords
});
});
function showCoords(c) {
$('#xaxis').val(c.x);
$('#yaxis').val(c.y);
$('#x2').val(c.x2);
$('#y2').val(c.y2);
$('#xwidth').val(c.w);
$('#div_width').val(c.w);
$('#yheight').val(c.h);
$('#div_height').val(c.h);
};
function clearCoords() {
$('#coords input').val('0');
$('#yheight').css({ color: 'red' });
window.setTimeout(function() {
$('#yheight').css({ color: 'inherit' });
}, 500);
};
然后我用在C#中这些坐标即可裁剪图片像
String savedFileName = uploadProfileImage(profileImageName, new System.Drawing.Rectangle(Int32.Parse(xaxis), Int32.Parse(yaxis), Int32.Parse(xwidth), Int32.Parse(yheight)));
public String uploadProfileImage(string profileImageName, System.Drawing.Rectangle rectangle)
{
try
{
String retFileName = "";
if (profileImageName != null || profileImageName != "")
{
GenerateCroppedThumbNail(profileImageName, rectangle);
}
return retFileName;
}
catch (Exception)
{
return String.Empty;
}
}
+0
GenerateCroppedThumbNail做什么?为什么你不把它看作是你的答案的一部分,因为它似乎是最重要的部分 – link64 2014-02-21 01:18:24
0
如果你在服务器上这样做,我建议使用a server-safe wrapper而不是直接使用System.Drawing,so you don't have to worry about avoiding the 29+ pitfalls and bugs。
我ImageResizing.Net library offers both automatic and manual cropping
自动
new ImageJob(source,dest,new
ResizeSettings("width=200;height=200;mode=crop;anchor=middlecenter")).Build();
手册(按百分比)
new ImageJob(source,dest,new
ResizeSettings("crop=20,20,80,80;cropxunits=100;cropyunits=100")).Build();
手册(源图像坐标)
new ImageJob(source,dest,new
ResizeSettings("crop=200,200,1000,1000;")).Build()
相关问题
- 1. 使用c裁剪图像#
- 2. 在C#和ASP.Net中使用jquery裁剪图像
- 3. 图像裁剪c#
- 4. c中的裁剪图像#
- 5. 如何在asp.net中裁剪tiff图像
- 6. 使用OpenCV C++裁剪图像
- 7. 使用Java裁剪图像
- 8. 使用openCV裁剪图像
- 9. 使用css裁剪图像
- 10. 使用php裁剪图像
- 11. 使用ImageScience裁剪图像
- 12. 裁剪图像使用jQuery
- 13. 使用CGImageCreateWithImageInRect裁剪图像
- 14. 使用CGImageRef裁剪图像
- 15. 在python中使用PIL裁剪图像
- 16. 使用QRubberBand在Qt中裁剪图像
- 17. 使用opencv在android中裁剪图像
- 18. 使用VBA在Powerpoint中裁剪图像
- 19. 裁剪图像C#Distorion
- 20. 裁剪图像objective-c
- 21. c#自动裁剪图像
- 22. 在C#中裁剪和编辑图像
- 23. 在C#中裁剪图像的空白#
- 24. WinRT中的裁剪/裁剪图像
- 25. 在运行时裁剪图像ASP.NET
- 26. 在android中裁剪图像
- 27. 在Java中裁剪图像
- 28. 在Matlab中裁剪图像
- 29. 在HTML5中裁剪图像
- 30. 在Richfaces中裁剪图像
你尝试过这工作正常?你为什么不尝试谷歌搜索? http://www.switchonthecode.com/tutorials/csharp-tutorial-image-editing-saving-cropping-and-resizing – 2012-04-04 13:39:02