0
나는 tiff 이미지를자를 수있는 루틴을 찾고 있었지만 얻었지만 많은 오류가 발생합니다. 다음은 루틴입니다.asp.net에서 tiff 이미지를 자르는 방법
Bitmap comments = null;
string input = "somepath";
// Open a Stream and decode a TIFF image
using (Stream imageStreamSource = new FileStream(input, FileMode.Open, FileAccess.Read, FileShare.Read))
{
TiffBitmapDecoder decoder = new TiffBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapSource bitmapSource = decoder.Frames[0];
using (Bitmap b = BitmapFromSource(bitmapSource))
{
Rectangle cropRect = new Rectangle(169, 1092, 567, 200);
comments = new Bitmap(cropRect.Width, cropRect.Height);
//first cropping
using (Graphics g = Graphics.FromImage(comments))
{
g.DrawImage(b, new Rectangle(0, 0, comments.Width, comments.Height),
cropRect,
GraphicsUnit.Pixel);
}
}
}
컴파일 할 때 오류가 발생합니다. 나는 구글을 검색하는 많은 어셈블리에 대한 참조를 추가하려했지만 그것을 해결할 수 없었다. 이 URL에서이 코드를 받았습니다.
http://snipplr.com/view/63053/
나는 조언을 구하고 있습니다.
확실한 오류를 추가하는 데 도움이됩니다 .... – rene
또한 TIFF 이미지 자체 (색상, 다중 프레임 등)에 대한 자세한 정보를 제공해주십시오. GDI + /. NET은 특정 종류의 TIFF 파일에 문제가 있습니다. – HackedByChinese