0
다음과 같은 방법으로 이미지의 크기를 조정하고 새로 크기가 조정 된 이미지를 TIFF로 반환합니다 (ResizeBilinear 개체의 출처 인 AForge 라이브러리를 사용하고 있습니다).C# 변경 TIFF 광도계 해석
private System.Drawing.Image shrinkImageBilinear(System.Drawing.Image original, float newWidthInches, float newHeightInches)
{
float imageProportion = (float)original.Width/(float)original.Height;
float newWidthPixels = original.HorizontalResolution * newWidthInches;
float newHeightPixels = newWidthPixels/imageProportion;
ResizeBilinear filter = new ResizeBilinear((int)newWidthPixels, (int)newHeightPixels);
Bitmap image = new Bitmap(original);
image = filter.Apply(image);
Rectangle imageRect = new Rectangle(0, 0, image.Size.Width, image.Size.Height);
image = image.Clone(imageRect, PixelFormat.Format1bppIndexed);
MemoryStream byteStream = new MemoryStream();
image.SetResolution(200, 200);
image.Save(byteStream, ImageFormat.Tiff);
Image returnImage = System.Drawing.Image.FromStream(byteStream);
return returnImage;
}
내가 쓸 필요가 스펙은 TIFF 헤더의 광도 해석은, 색상 팔레트를 활용할 수 있으므로 광도 해석은 0 또는 1,이 경우에는이 세 이후입니다 수 있다는 것입니다 PixelFormat.Format1bppIndexed를 사용하고 있습니다. 내가 쓰고있는 사양의 또 다른 요구 사항은 이미지가 1bpp 여야한다는 것입니다.
내 질문은, 어떻게하면 컬러 팔레트를 활용하지 않고 (따라서 광도계 해석을 1 또는 0으로), 1bpp를 유지하면서 해상도를 200ppi로 유지하고 형식을 TIFF로 유지하면서이 이미지를 만들 수 있습니까?