Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Reg saving rotated image from image control in WPF

$
0
0

Hello,

I have rotated image by some angle by applying transform to image control as shown below.

RotateTransform rt = newRotateTransform(angleNew); image1.RenderTransform = rt;

image1 is image control.

How can I save this rotated image? Tried below code, but, it is saving original image without rotation.

var encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create((BitmapSource)image1.source));
using (FileStream stream = new FileStream("D:\\TestImage.png", FileMode.Create))
      encoder.Save(stream);

             


Harish


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>