Orientation is not rotating properly
rohank05 opened this issue · 1 comments
So I am using orientation to rotate the image. I am using 90 to rotate but sometimes it is rotating 180 sometimes it is rotating 270 sometimes it doesn't even rotate
if (angle < 0) { angle = 360 - angle; } switch (angle) { case 90: var orientation = Orientation.Rotate90; transforms.Add(new OrientationTransform(orientation)); break; case 180: orientation = Orientation.Rotate180; transforms.Add(new OrientationTransform(orientation)); break; case 270: orientation = Orientation.Rotate270; transforms.Add(new OrientationTransform(orientation)); break; default: throw new ArgumentException("Only 90/180/270 degree rotation is supported"); }
using (var pl = MagicImageProcessor.BuildPipeline(sourceStream, settings)) { foreach (var transform in transforms) { pl.AddTransform(transform); } pl.WriteOutput(stream); }
Do you have a complete repro you can share, along with input image?
My guess is you've got input images that have orientation metadata embedded, which will be auto-corrected when using the default OrientationMode
setting. This correction is applied as part of the base pipeline, before any additional orientation steps you add.