0

Are there any ways to open an image which has been uploaded by <input type="file" /> , through the default image viewer of an operating system in the client side using plain javascript. ? I went through several resources but did not get a proper answer for this problem.

Here is what I am trying to achieve... This is for a completely client sided application without any backend. The user uploads few image files through html file input. I want the user to open the images he uploaded through the default image viewer of his OS. If user is using android, it should be opened through google photos or whatever user has selected default. If user is using Windows OS, it should be opened through windows photo viewer or something he has selected default. Likewise user should be able to open the image through their default photo viewer in their respective operating system in the device?

Are there any APIs or libraries for this approach? Only if there are no any solutions, are there any other better approaches to achieve this effect?

Rifky Niyas
  • 1,737
  • 10
  • 25
  • 1
    I don't think this is possible, you file is either in the browser or on the host system. – sxkx Feb 04 '21 at 17:55
  • In the browser. – Rifky Niyas Feb 04 '21 at 18:20
  • You could try and force an image download, however, they'd still have to open the downloaded image manually. Why don't you use an image gallery lib? – gugateider Feb 04 '21 at 18:29
  • @gugateider. Ok as far as I have seen the answers, it seems like its impossible to perform this task. One small doubt is about PWAs. Can PWAs access the default image viewer just like lets say android apps open default image viewers? – Rifky Niyas Feb 04 '21 at 23:47
  • If that too is impossible, can you explain the benefits of an image gallery lib? And also can you please give any questions on forcing and downloading the images that has just been submitted to the form? Remember there is no backend for my app – Rifky Niyas Feb 04 '21 at 23:49
  • I think your user flow is a bit confusing, why would you open the image that the user has just uploaded? Very likely the user had already seen the image just before it had selected. @RifkyNiyas If that is the case I would just show the uploaded image right there in the browser, no need for leaving the app to see the image in a default viewer. Could you explain the reason you want that? – gugateider Feb 05 '21 at 02:57
  • @gugateider Here is the reason. I am making an image classification app where user uploads a folder or several images. The app scans the text in the image and provides the user the correct image he searches using the keywords he provides. I thought it would be easier for the user if we are able to open the image in default image viewer since he may share it or do whatever he requires through that image viewer. If this approach is unnecessary, I am open for suggestions. – Rifky Niyas Feb 05 '21 at 03:14

0 Answers0