GithubHelp home page GithubHelp logo

portrait's Introduction

I took this picture of Mark Twain:

mark twain

Pixelated it into this:

mark twain pixelated

When you zoom closer you will see quotes from Mark Twain:

mark twain twist

Explore it live here: https://anvaka.github.io/portrait/

Map Navigation

You can explore the portrait the same way you would explore Google Maps. Most of the keyboard/mouse/touch shortcuts should be familiar:

  • +/-, Mouse wheel/Pinch, Single click, Double tap - Zoom in/out
  • Left arrow - Move left
  • Right arrow - Move right
  • Up arrow - Move up
  • Down arrow - Move down
  • Mini map click - Reset zoom

Tidbits

  • The page address updates as you explore the map. So if you send link to someone - they will see what you see.
  • To fully zoom out - click on the mini-map portrait
  • When fully zoomed out - help text appears

How does this work?

I wrote down more than 200 Mark Twain's quotes. Mostly quotes came from reddit and Goodreads.

Then I sorted them according to their popularity (e.g. by number of votes on reddit, or likes on good reads), and dropped them onto canvas.

Once I got the canvas, I saved it into high-resolution png file (8,000 x 8,000 pixels).

  • I used OpenSeadragon to have pan and zoom support.
  • When URL changes, I update query string, so that you can share favorite quotes. The query string state is managed by query-state

The canvas algorithm

The canvas algorithm works by randomly traversing empty space of the mask, trying to find a rectangle that will fit required box. This bit of the code is not yet available since it requires good amount of hand-tuning. However if you'd like to play with ready-to-use code, I can highly recommend amueller/word_cloud Python package.

Have an advice?

If you'd like to explore other portraits in a similar way or have a suggestion how to make this better, please reach out to me:

Enjoy!

That's it! Hope you enjoy exploring Mark Twain's wisdom in a new, artistic way!

portrait's People

Contributors

anvaka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.