C
Cecil Windham
I'm using the following code to rotate an image (jpeg or gif), and have
discovered that there is a significant degradation in the quality of the
photo.
Just wondering if there is a way to rotate/flip a graphic in .NET *without*
data loss. If so, how? If not, why?
I understand that when *resizing* a graphic, some degradation in the
appearance will result from the loss of data. However, when it comes to
simply rotating or flipping a graphic, is it necessary that any data loss
will occur?
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);
// then either of these depending on the origina'ls format (jpeg or gif):
imageToFlip.Save(pathToOriginal, System.Drawing.Imaging.ImageFormat.Jpeg);
imageToFlip.Save(pathToOriginal, System.Drawing.Imaging.ImageFormat.Gif);
Thanks.
discovered that there is a significant degradation in the quality of the
photo.
Just wondering if there is a way to rotate/flip a graphic in .NET *without*
data loss. If so, how? If not, why?
I understand that when *resizing* a graphic, some degradation in the
appearance will result from the loss of data. However, when it comes to
simply rotating or flipping a graphic, is it necessary that any data loss
will occur?
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);
// then either of these depending on the origina'ls format (jpeg or gif):
imageToFlip.Save(pathToOriginal, System.Drawing.Imaging.ImageFormat.Jpeg);
imageToFlip.Save(pathToOriginal, System.Drawing.Imaging.ImageFormat.Gif);
Thanks.