जब मैं एक छवि घुमाता हूं, तो नेट टिफ एन्कोडिंग स्विच करता है। क्या कोई तरीका है कि मैं सीसीआईटीटी फैक्स 4 (ग्रुप 4 फ़ैक्स एन्कोडिंग) रख सकता हूं और यह एलजेडब्लूडब्लू पर स्विच नहीं कर सकता है? यहां बताया गया है कि मैं डिस्क पर एक छवि को घुमा रहा हूं।नेट छवि। सीटीटीआईटी फैक्स 4 से एलजेडब्लूडब्लू
System.Drawing.Image img = System.Drawing.Image.FromFile(input);
//rotate the picture by 90 degrees
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
img.Save(input, System.Drawing.Imaging.ImageFormat.Tiff);
धन्यवाद, ब्रायन
अद्यतन: यहाँ नीचे दिए गए लेख से जुड़ा हुआ के आधार पर कोड है। मैं यहां पूर्णांक के लिए कोड जोड़ना चाहता था। साथ ही, मैंने क्षैतिज रिज़ॉल्यूशन सेट किया क्योंकि बिटमैप्स 96 डीपीआई के लिए डिफ़ॉल्ट है।
//create an object that we can use to examine an image file
System.Drawing.Image img = System.Drawing.Image.FromFile(input);
//rotate the picture by 90 degrees
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
// load into a bitmap to save with proper compression
Bitmap myBitmap = new Bitmap(img);
myBitmap.SetResolution(img.HorizontalResolution, img.VerticalResolution);
// get the tiff codec info
ImageCodecInfo myImageCodecInfo = GetEncoderInfo("image/tiff");
// Create an Encoder object based on the GUID for the Compression parameter category
System.Drawing.Imaging.Encoder myEncoder = System.Drawing.Imaging.Encoder.Compression;
// create encode parameters
EncoderParameters myEncoderParameters = new EncoderParameters(1);
EncoderParameter myEncoderParameter = new EncoderParameter(myEncoder, (long)EncoderValue.CompressionCCITT4);
myEncoderParameters.Param[0] = myEncoderParameter;
// save as a tiff
myBitmap.Save(input, myImageCodecInfo, myEncoderParameters);
// get encoder info for specified mime type
private static ImageCodecInfo GetEncoderInfo(String mimeType)
{
int j;
ImageCodecInfo[] encoders;
encoders = ImageCodecInfo.GetImageEncoders();
for (j = 0; j < encoders.Length; ++j)
{
if (encoders[j].MimeType == mimeType)
return encoders[j];
}
return null;
}
धन्यवाद कि काम करता है:
यहाँ अधिक जानकारी के कर रहे हैं। हालांकि डीपीआई को 300 से 96 तक बदल रहा है। क्या कोई इसे जानता है कि इसे कैसे सेट किया जाए? – BrianK
मुझे लगता है कि छवि वर्ग इसका समर्थन करता है (कम से कम यह मेरे लिए काम कर रहा है)। तो आपको अतिरिक्त बिटमैप रखने की आवश्यकता नहीं है, और एक अतिरिक्त बोनस के रूप में संकल्प के साथ गड़बड़ करने की कोई आवश्यकता नहीं है। – user12861
ब्रायनके: बिटमैप.SetResolution() यह करेगा, (हालांकि यह शायद 2 साल बाद आपकी मदद नहीं करेगा!) – user20493