Rotate a BitmapImage

后端 未结 2 1026
南笙
南笙 2021-01-14 07:24

I want to rotate a bitmap image I wrote some code and it work

TransformedBitmap TempImage = new TransformedBitmap();

TempImage.BeginInit();
TempImage.Sourc         


        
2条回答
  •  遥遥无期
    2021-01-14 07:28

    How about this:

    BitmapImage image = new BitmapImage();
    image.BeginInit();
    image.CacheOption = BitmapCacheOption.OnLoad;
    image.UriSource = new Uri(ImagePath);
    
    // here
    image.Rotation = Rotation.Rotate270; // or 90, 0, 180
    
    image.EndInit();
    

提交回复
热议问题