Jump to content

Open image from web


Recommended Posts

Hello everybody,

I am trying to open a picture directly from the web following the approach described here below:

 

1- created a keyword to open automatically paintdotnet with a magnet url (create a .reg file and paste/run this code):

    REGEDIT4

 
    [HKEY_CLASSES_ROOT\keywordTest]
    @="URL:keywordTest Protocol"
    "URL Protocol"=""
 
    [HKEY_CLASSES_ROOT\keywordTest\shell]
 
    [HKEY_CLASSES_ROOT\keywordTest\shell\open]
 
    [HKEY_CLASSES_ROOT\keywordTest\shell\open\command]
    @="\"C:\\Program Files\\paint.net\\PaintDotNet.exe\" \"%1\"" 
 
2- started a browser and typed:
 
 
PaintDotNet runs correctly but an error appears: "There was an error while opening the file." and the stack trace is the following:
 
System.NotSupportedException: The given path's format is not supported.
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
   at PaintDotNet.Controls.DocumentWorkspace.LoadDocument(Control owner, String fileName, FileType& fileTypeResult, ProgressEventHandler progressCallback) in d:\src\pdn\paintdotnet\src\PaintDotNet\Controls\DocumentWorkspace.cs:line 3205
 
 
If I open the image starting from paintDotNet, everything is working, but obviously I need another behavior :-)
 
Thank you very much if someone can give me a solution or some hints.

 

Link to comment
Share on other sites

Paint.NET doesn't support loading a URL from the command line.

 

You can, however, use File -> Open to load from a URL. Just paste it into the "File name:" box and click Open. This works because the Windows shell (e.g. Explorer) provides the common Open dialog and it allows this. It will first download the file to a temporary local folder (without a progress bar or cancel button, mind you!) and then forward that local path to Paint.NET. You certainly won't be able to save back to the original URL.

 

But, keep in mind that that's functionality of the Open dialog. It doesn't work outside of it.

  • Upvote 1

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Thank you very much Rick for the answer.

 

I was not aware of the functionality of Explorer to download the files automatically. Obviously I cannot save the image in the original URL :-)

 

Your confirmation is very useful and I have understood I cannot do what I would like to have.

 

Thanks.

Link to comment
Share on other sites

Yeah the Open dialog supplied by Explorer has a lot of interesting features.

 

For instance, you can plug in a camera or phone and use that dialog to load pictures from the device even though they don't have file system paths (it copies it to a local path first, just like for http:// "files"). They exist as virtual nodes inside of Explorer's virtualized "namespace". Other things that exist in the "Explorer namespace" include Libraries, the Control Panel, etc. 

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...