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

  • SEARCH
  • Home
  • 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 7403037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:56:47+00:00 2026-05-29T04:56:47+00:00

While converting TIFFs to PDFs, I noticed some of the PDFs were corrupted. After

  • 0

While converting TIFFs to PDFs, I noticed some of the PDFs were corrupted. After some research, it appears the problem is in the System.Drawing.Image class. To test this, instead of converting to PDFs, I had the program just read in the image files and re-save them. Some of the newly saved files have inconsistent file sizes between different runs of the program. The basic steps are:

  1. I read a TIFF image into a byte array.
  2. I use the System.Drawing.Image.FromStream() method to create an image object from the byte array.
  3. I then call the System.Drawing.Image.Save(stream) method to save the image to a new stream.
  4. I then examine the length of the stream.ToArray() method.

The same input file results in a different output length between successive program executions. The output length varies by a couple hundred bytes. In addition, the resulting output length is more than twice the size of the input length, but I assume this is due to compression, or lack thereof. I am running this on windows 7 32-bit with .net 4.

Why might the output length vary like this?

UPDATE:

After reviewing this connect issue (https://connect.microsoft.com/VisualStudio/feedback/details/584681/system-drawing-image-flags-has-different-value-in-vista-and-windows-7) and the community comment on this MSDN page (http://msdn.microsoft.com/en-us/library/system.drawing.image.save.aspx), it appears the issue is related to an operating system level bug in Windows 7. Can anyone confirm this or offer a workaround?

  • 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-29T04:56:48+00:00Added an answer on May 29, 2026 at 4:56 am

    As stated in my update, after reviewing this connect issue (https://connect.microsoft.com/VisualStudio/feedback/details/584681/system-drawing-image-flags-has-different-value-in-vista-and-windows-7) and the community comment on this MSDN page (http://msdn.microsoft.com/en-us/library/system.drawing.image.save.aspx), it appears the issue is related to an operating system level bug in Windows 7.

    In addition, when the images are read in Windows XP, the flags property on the image object is set to 77888. On Win7, it is set to 77840. After reviewing the MSDN documentation for the flags property (http://msdn.microsoft.com/en-us/library/system.drawing.image.flags.aspx), the difference is that WinXP flagged the image as a grayscale image (which mine are), but Win7 flagged it as an RGB image. This appears to be a symptom of the problem, but I don’t know enough about image formats and color spaces to speak with authority on this.

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

Sidebar

Related Questions

I got some weired problem while converting data type in ruby. Here are some
I have a problem while converting a string whose value is dd.mm.yyyy to DateTime
I've got a problem converting an object property to string while using reflection... string
Possible Duplicate: Parse C# string to DateTime I am facing a problem while converting
I'm starting to use simple_form for a rails application, and while converting some of
I need to convert MimeMessage into byte array, but while converting some characters are
I'm facing an Out of Memory Exception while converting a 1.8MB image to bytes
I have a problem converting dates while updating an SQL table in VB under
While converting an old code, I encountered the following problem. Given an HTML string,
While decoding,I am getting NSData bytes by decoding a string.I am converting NSData bytes

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.