I'm trying to edit a image file where instead of path i should be able to provide ImageSource
as parameter.
//EditCode:
Process proc = Process.Start(Path);
proc.EnableRaisingEvents = true;
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.Verb = "edit";
proc.StartInfo = startInfo;
proc.Exited += new EventHandler((s, e) => myProcess_Exited(s, e, obj.ToString()));
The above code works well when i pass the Path
of the image file as the parameter. But now i have only the ImageSource
.
//ImageSourceCode:
private BitmapFrame LoadImage(string path)
{
BitmapDecoder decoder = null;
if (File.Exists(path) && (path != null))
{
using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
decoder = BitmapDecoder.Create(stream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
}
return decoder.Frames.FirstOrDefault();
}
else
return null;
}
The above code gets the path and convert an image as a source(BitmapFrame) and returns it.
Now i need this BitmapFrame
to be passed in some function and edit the particular image file in paint and save it.
I neeed somthing like this,
Process proc = Process.Start(`ImageSource`);// Instead of path i need to pass the Image Source.
proc.EnableRaisingEvents = true;
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.Verb = "edit";
proc.StartInfo = startInfo;
How can i achieve this?