├── js.png ├── recognized-code.png ├── README.md └── index.html /js.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bahmutov/image-as-script/HEAD/js.png -------------------------------------------------------------------------------- /recognized-code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bahmutov/image-as-script/HEAD/recognized-code.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # image-as-script 2 | 3 | People argue why the websites are so slow - is it the large images or lots of 4 | JavaScript? The next natural step is to send large images *with JavaScript*. 5 | Then one can run [character recognition library](https://github.com/antimatter15/ocrad.js) 6 | to get the JavaScript out of the image and execute it. Seems reasonable. 7 | 8 | ![Recognized JS code](recognized-code.png) 9 | 10 | This repo: [https://github.com/bahmutov/image-as-script](https://github.com/bahmutov/image-as-script) 11 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Image As Script 5 | 6 | 7 | What takes longer to send from the server: images or JavaScript? 8 |

JavaScript in the image

9 |

Below is screenshot of some JavaScript

10 | 11 |

Now this browser will run optical character recognition and 12 | then will execute the recognized code

13 |

Uses ocrad.js library.

14 | 15 |

This repo at github.com/bahmutov/image-as-script. Font "Times Roman" was most reliably recognized. 16 | Demo requires a server to run, will not work from file:// protocol.

17 |

Recognized code 18 |

19 |   

20 | 42 | 43 | 44 | --------------------------------------------------------------------------------