Unexpected Thumbnail Generation Behavior

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Cecil Windham (DocHoliday_at_YelloZonker.com)
Date: 04/07/04


Date: Wed, 7 Apr 2004 11:24:52 -0700

I'm enabling users to rotate photos and generate thumbnails.

I have discovered that if, after a user rotates a photo 180 degrees, then
generates a thumbnail, that the resulting thumbnail appears unrotated (i.e.,
in original position, or rotated zero degrees).

Why is this? (and yes, I have verified that the "original" from which the
thumbnail is generated has, in fact, been rotated 180 degrees prior to
generating the thumbnail).

Here is the code that creates thumbnail:
System.IO.FileStream fs = new System.IO.FileStream(pathToFullSizeImage,
System.IO.FileMode.Open, System.IO.FileAccess.Read);
System.Drawing.Image objThumbnail =
System.Drawing.Image.FromStream(fs).GetThumbnailImage(iWidth, iHeight, null,
IntPtr.Zero);

Here is the code that rotates the original:
System.IO.FileStream fs = new System.IO.FileStream(pathToOriginal,
System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite);
System.Drawing.Image imageToFlip = System.Drawing.Image.FromStream(fs);
imageToFlip.RotateFlip(System.Drawing.RotateFlipType.Rotate90FlipNone);
// In order to rotate 180 degrees, the user clicks a button twice, which
executes above code twice.

Repeatedly clicking the button that executes the above code causes the
original to rotate in 90 degree increments: can go all the way around with
no problem, and thumbnails can be subsequently generated that reflect the
original's current rotation position - with the only exception being when
the original is rotated 180 degrees.

Any clues or explanations are greatly appreciated!



Relevant Pages

  • Re: Why is thumbnail in landscape?
    ... Was the Explorer window open when the picture was rotated? ... used to rotate the picture? ... >>>thumbnail is shown in landscape mode, ...
    (microsoft.public.windowsxp.photos)
  • Re: right-click menu vanished!
    ... Is the Rotate.. ... Have you set the folder view to Thumbnail?? ... What's the file type involved??? ... MS Picture It! ...
    (microsoft.public.windowsxp.photos)
  • Rotating Images In Folders
    ... When I open a folder of jpeg's in "thumbnail" view and I want to ... rotate an image either by right clicking or using the FILE/ROTATE ...
    (microsoft.public.windowsxp.help_and_support)