-1

here is what i want to do, I have a js script that manipulates an image by changing some of the pixel colors.

what I want to is to be able to right click on an image and choose to run that script on that image, and then open it in the windows image viewer, is this possible?

or maybe alternatively I can drag and drop an image onto the js file and again the js runs, manipulates the image and opens the result in image viewer?

  • Well, in direct answer to your title question, `NodeJS` is a popular toolkit for running JavaScript as a commandline, or sometimes UI-based, program. It may require small extensions to operate on various files and open other programs, but generally what you're asking for sounds doable. There are also some other options for command-line Javascript runtimes. Of course, you'll have to do some research on your own. – Katana314 Dec 17 '15 at 17:05
  • Out of curiosity, how are you manipulating an image in JS? I'm not aware of any native JS methods that will do that. If you aren't using something native to JS, you will probably want to include what you are using in your question since it will likely influence the answer somebody gives. For example, if you are using the DOM to manipulate the image, you will need to run the JS in a browser. – Brian Dec 17 '15 at 17:08

2 Answers2

0

As far as I know, if you click two times on a .js file under Windows. The system will actually run the script -_-. I don't think you can drag a file on to the script, but maybe in the code you can point to the file that you want to change.

If I was you, I would Google "Windows PowerShell JavaScript".

Another way to do it, would be to use NodeJS. Then once you have NodeJS installed under your system, you can run any .js code natively by typing `node my_script.js" in your cmd window. NodeJS for sure will give you access to the file system.

Hope this points you in the right direction.

David Gatti
  • 3,061
  • 23
  • 59
0

i think you want a command-line interpreter. It permit you ton run your js script as a Python or a Bash one.

Have a look a this post : Executing JavaScript without a browser?

Community
  • 1
  • 1
Jidey
  • 299
  • 2
  • 5
  • 20