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.FileS tream fs = new System.IO.FileS tream(pathToFul lSizeImage,
System.IO.FileM ode.Open, System.IO.FileA ccess.Read);
System.Drawing. Image objThumbnail =
System.Drawing. Image.FromStrea m(fs).GetThumbn ailImage(iWidth , iHeight, null,
IntPtr.Zero);
Here is the code that rotates the original:
System.IO.FileS tream fs = new System.IO.FileS tream(pathToOri ginal,
System.IO.FileM ode.Open, System.IO.FileA ccess.ReadWrite );
System.Drawing. Image imageToFlip = System.Drawing. Image.FromStrea m(fs);
imageToFlip.Rot ateFlip(System. Drawing.RotateF lipType.Rotate9 0FlipNone);
// 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!
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.FileS tream fs = new System.IO.FileS tream(pathToFul lSizeImage,
System.IO.FileM ode.Open, System.IO.FileA ccess.Read);
System.Drawing. Image objThumbnail =
System.Drawing. Image.FromStrea m(fs).GetThumbn ailImage(iWidth , iHeight, null,
IntPtr.Zero);
Here is the code that rotates the original:
System.IO.FileS tream fs = new System.IO.FileS tream(pathToOri ginal,
System.IO.FileM ode.Open, System.IO.FileA ccess.ReadWrite );
System.Drawing. Image imageToFlip = System.Drawing. Image.FromStrea m(fs);
imageToFlip.Rot ateFlip(System. Drawing.RotateF lipType.Rotate9 0FlipNone);
// 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!