2016-07-09 17 views
1

Ich erstellte eine beschnittene Bitmap und jetzt möchte ich es speichern. Ich weiß, wie man einen Bitmapframe speichert, aber ich weiß nicht, wie man es in einen Bitmapframe umwandelt.So speichern Sie eine "CroppedBitmap"

Code:

' Create an Image element. 
    Dim croppedImage As New Image() 
    croppedImage.Width = 200 
    croppedImage.Margin = New Thickness(5) 

    ' Create a CroppedBitmap based off of a xaml defined resource. 
    Dim cb As New CroppedBitmap(CType(screenshot, BitmapSource), New Int32Rect(X, Y, breite, höhe)) 
    'select region rect 
    croppedImage.Source = cb 'set image source to cropped 

Deshalb möchte ich das neue Bild als Datei speichern.

+1

einige Ideen http://stackoverflow.com/questions/21275602/how-to-convert-a-croppedbitmap- Zu-Bitmap-Bild – Neolisk

Antwort

0

Hallo habe ich die gleiche Sache in wpf, ich hoffe, dass Sie in vb umwandeln kann

void saveCroppedBitmap(CroppedBitmap image,string path) 
{ 
FileStream mStream = new FileStream(path, FileMode.Create); 
JpegBitmapEncoder jEncoder = new JpegBitmapEncoder(); 
jEncoder.Frames.Add(BitmapFrame.Create(image)); 
jEncoder.Save(mStream); 
} 
Verwandte Themen