Find the visual center of your images.
JavaScript HTML CSS
Latest commit 56478a1 Aug 30, 2016 @javierbyte Update UI
Permalink
Failed to load latest commit information.
dist Update UI Aug 30, 2016
docs-assets Update thumbnail May 17, 2016
src Update UI Aug 30, 2016
styles Update UI Aug 30, 2016
webpack Initial commit May 12, 2016
.babelrc Initial commit May 12, 2016
.gitignore Initial commit May 12, 2016
CHANGELOG.md Bump versino to 0.1.1 May 18, 2016
README.md Add licence Aug 30, 2016
index.html Update facebook open graph metadata May 17, 2016
package.json Add licence Aug 30, 2016

README.md

Visual Center.

This is a tool that will find the visual center of your images.

visual-center

Why is this important: https://medium.com/@lukejonesme/optical-adjustment-b55492a1165c

How it works.

It calculates a visual weight value for every pixel on the image: the square root of the difference between that pixel and the background color. And then the algorithm tries to balance that weight in all directions.

Why the square root? http://spectrum.ieee.org/podcast/biomedical/bionics/does-the-brain-work-logarithmically

Programmatic Usage.

npm install visual-center --save
const getVisualCenter = require('visual-center')

getVisualCenter(<base64Image>, function(err, result) {
  /*
    results in an object with the data as:
      {
        visualTop: <Visual center for Y axis, from 0 to 1>
        visualLeft: <Visual center for X axis, from 0 to 1>
        bgColor: <The background color that we detected>
        width: <The width of the image>
        height: <The height of the image>
      }
  */
})

Licence.

MIT.