Coder Social home page Coder Social logo

webgbcam's Introduction

webgbcam

A simple Game Boy Camera-style filter made in HTML5 and JavaScript

Play with it here!

Disclaimer

As of this commit, this is simply a direct copy of the files currently in my webserver. Eventually, I will clean things up and make improvements to the code, but since there has been interest in looking at the code, I'm mirroring the files here.

A quick explanation of how it all works

The concept of Bayer dithering was hard for me to grasp at first, but after a few different projects getting acquainted with it, I've found an easy way to apply it, which can be used in a procedural setting like JS Canvas filters, or shaders.

Basically, you start with an array of pixels, then grayscale them and optionally apply simple arithmetics to apply gamma and contrast adjustments. Then, you offset those by the value in the Bayer matrix corresponding to that pixel, giving it a patterned look. Finally, you divide and quantize the values until all pixels each have only one of four possible values. This will give you a dithered pixel art look. After this, my code applies a palette swap for those 4 values back to RGB space.

Acknowledgements

Thanks to Christine Love for making the Interstellar Selfie Station back in 2014. It helped me a lot with my dysphoria and was the inspiration to learning how Bayer dithering works in order to remake her camera app once it was no longer available in app stores.

Thanks to Joel Yliluoma's arbitrary-palette positional dithering algorithm page, which was the first analysis of ordered dithering that I found comprehensible and used to implement the filter in different applications.

Thanks to lospec.com for making a list of palettes available, many of which were used in this project.

License

/*
 * ------------------------------------------------------------
 * "THE BEERWARE LICENSE" (Revision 42):
 * maple "mavica" syrup <[email protected]> wrote this code.
 * As long as you retain this notice, you can do whatever you
 * want with this stuff. If we meet someday, and you think this
 * stuff is worth it, you can buy me a beer in return.
 * ------------------------------------------------------------
 */

webgbcam's People

Contributors

lana-chan avatar andrigamerita avatar

Watchers

James Cloos 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.