1
我試圖編輯一個圖像文件,而不是路徑我應該能夠提供ImageSource
作爲參數。編輯圖像源C#
// 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()));
上面的代碼效果很好,當我通過將圖像文件作爲參數的Path
。但現在我只有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;
}
上面的代碼得到的路徑和轉換的圖像作爲源(BitmapFrame)並將其返回。
現在我需要這BitmapFrame
傳遞一些功能,並編輯特定的圖像文件在繪製並保存。
我neeed財產以後這樣的,
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;
我怎樣才能做到這一點?
感謝您的評論。我有其他方法來實現這個功能嗎? – iamCR
唯一可能的解決方案是創建應用程序並使用WCF inproc或某些其他協議傳遞結構。使用OS中的註冊程序編輯圖像...我不這麼認爲。你可以嘗試... http://stackoverflow.com/questions/11179241/open-process-paste-text-within-this-process – Mick
是否有可能編輯圖像以外的其他圖像?僅供參考,我的是WPF應用程序。 – iamCR