/CanvasBot

A Canvas Bot originally made for https://github.com/xSke/Pxls.

Primary LanguageJavaScriptMIT LicenseMIT

CanvasBot

This bot is meant for https://github.com/xSke/Pxls.

This bot will automatically print an image of your choosing in the canvas with a certain delay per pixel drawn.

Requirements

  • Node.js
  • An Image (Only JPG or PNG)
  • A Web Browser with a Developer Console that supports interacting with the page's javascript. (Chrome, Firefox and most standard web browsers will do)

Instructions

Install

  • Go to the root of the project.
  • Execute from the command line:
npm install

This will install al the necessary modules.

Step 1

  • Get an image of your choosing and process it using:
node index.js path_to_your_file

This will output a JSON string with the image's pixels information to output.txt. By default the script will ignore whites, because the background is usually white, if you wish to also print the whites add "full" to the arguments.

node index.js path_to_your_file full

Step 2

  • Open the file js.js, this file contains the javascript that you will have to use in the browser.
  • Replace the data varaible with the JSON string from output.txt.
  • Copy the whole script.

Step 3

Finally, you will execute the script in the browser. You can do this by pasting the script in the console or using something like TamperMonkey.

  • Goto the Site with the Canvas you want to draw on.
  • Open the Developer Console
  • Paste the script from js.js
  • Execute the script by entering in the console
nextPixel();

Done! You should now see the color changing and the pixels appearing in the canvas.