Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open an image with the Windows default editor in C#

In my C# application, I would like to launch the default image editor to edit an image.

When I'm using System.Diagnostics.Process.Start("C:\\image.png") it opens the image file using the Windows Photo Viewer.

When I right-click on the image file in Windows Explorer, there is a "Edit" menu item which launches Microsoft Paint (by default). I would like to do the same in my application (i.e. open the file using the default image editor).

I don't want to hardcode MS Paint by doing Process.Start("mspaint.exe C:\\image.png"). I would prefer to use the default image editor program set by the user (which can be different from MS Paint).

Is there a way to do this?

Thanks Frank

like image 876
Francois C Avatar asked Apr 15 '13 18:04

Francois C


People also ask

What is the default photo editor for Windows 10?

Microsoft Photos, the free photo viewer and editor included with Windows 10, offers competent image editing and photo enhancements along with tools for organizing and editing videos, all in a touch-friendly interface.


1 Answers

You can try starting a process with a verb edit.

ProcessStartInfo startInfo = new ProcessStartInfo("C:\\image.png");
startInfo.Verb="edit";

Process.Start(startInfo);
like image 84
alex Avatar answered Oct 12 '22 14:10

alex