I'm trying to write a code that gets an Image (PNG, JPG, BMP, ETC') crops and rotate the image. I want to crop the image without losing information (no change in interpolation) so i am using
Bitmap target = new Bitmap(cropRect.Width, cropRect.Height);
using (Graphics g = Graphics.FromImage(target))
{
g.DrawImage(img, new Rectangle(0, 0, target.Width, target.Height),
cropRect,
GraphicsUnit.Pixel);
}
where target is the cropped image. img is the originial image and cropRect is the cropping rectangle i want to crop. Because i maintain the image size (no zoom) there shouldn't be any information lost.
Afterwards i am rotating the image using
target.RotateFlip(RotateFlipType.Rotate90FlipNone);
because it is 90 degrees rotation - it should remain lossless. Is that correct? I couldn't find any documention on that subject, if anybody has a link i would appreciate it!