pictoprime
pictoprime copied to clipboard
Javascript novice requesting assistance
Please could somebody tell me explicitly how to use this code (in particular to convert an image into a prime)
- Do I need to save the code, its dependencies or the image I wish to convert anywhere specific?
- What should I type into node in order to run the program?
- I've tried pictoprime -V , pictoprime -i , $ pictoprime -V etc.
This is not an issue with the code, it's an issue with my knowledge and I would really appreciate it if someone could tell me how to use it. I initially started to learn javascript (in a few spare hours) to figure out how to use this code, but it and the instructions given are just as opaque to me as they were before. Please help :)
After installing the Dependencies you can run the program in one of two ways;
- Clone the repo and run the file directly
In short, here are the terminal commands;
git clone https://github.com/TotalTechGeek/pictoprime folder/to/use/
npm i # or `yarn` if you use yarn, or `pnpm i` if you use pnpm
node index.js [options]
# to dump the prime number image to a text file for viewing; (I'm uncertain if this works on windows or not)
node index.js --image ./examples/headshot.png -x ascii > outFile.txt
git clone ...
copies the code here in the repo to your computer so you can run it.
npm i
will install the node dependencies (but not these dependencies)
node index.js [options]
is your access point to the tool, pass in the options you want to use
node index.js --image ...
is an example of turning the headshot of Matt into a prime number in a text file.
--image ./examples/headshot.png
tells the program to use the image headshot.png
in the examples
folder
-x ascii
tells the program to print the text to the terminal as plain text
-q
tells the program to be silent until it's ready to print the plain text, it might seem like it's frozen but it's actually working fine in silence
> outFile.txt
tells your terminal to take whatever the program outputs, and to write it in the file outFile.txt
. (note that you may have to delete the file to run again unless you change the "outFile" name)
- Use pictoprime as an npm executable
In short, here are the terminal commands;
npx pictoprime [options]
# to dump the prime number image to a text file for viewing; (I'm uncertain if this works on windows or not)
npx pictoprime --image ./examples/headshot.png -x ascii > outFile.txt
these two commands do the same as their option 1 counterparts beginning with node index.js
Getting an image output doesn't appear to be a capability of this program yet, but you can still take a screenshot of the text file if you want an image.