Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3617626
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:38:56+00:00 2026-05-18T22:38:56+00:00

When I rotate an image, .Net switches the tiff encoding. Is there a way

  • 0

When I rotate an image, .Net switches the tiff encoding. Is there a way I can keep the CCITT Fax 4 (Group 4 Fax encoding) and not have it switch to LZW? Here is how I am rotating an image on disk.

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);

Thanks,
Brian

Update: Here’s the code based on the articles linked to below. I wanted to add the code here for completenes. Also, I set the horizontal resolution because the bitmaps defaults to 96 DPI.

//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;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:38:56+00:00Added an answer on May 18, 2026 at 10:38 pm

    The Image class isn’t going to give you the necessary granular controls.

    To do this, you’ll need to read into a Bitmap, create a TIFF encoder, set the parameter for the type of compression, then have the Bitmap object save the image using that codec and parameter.

    Here’s an example that should lead you the right direction:

    http://msdn.microsoft.com/en-us/library/system.drawing.imaging.encoder.compression.aspx

    I don’t have VS open, on my Mac at the moment.

    Here are more details:

    http://social.msdn.microsoft.com/Forums/en/windowswic/thread/e05f4bc2-1f5c-4a10-bd73-86a676dec554

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the best way to rotate a image in asp.net I did use
How do you rotate an image using jQuery-rotate plugin? I have tried the following
I have a simple 3D cube that I can rotate using the following code:
In flash10 I can easly rotate an image around its center in 3D space.
When you rotate an image using canvas, it'll get cut off - how do
How do you rotate an image with the canvas html5 element from the bottom
I want to have in my GUI capability for scale, rotate and crop images
How can I rotate the Apache Access and Error logs on a Window 2000
I have a 3d object that I wish to be able to rotate around
I am trying to figure out how to do a server ASP.NET MVC Image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.