Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/javierbyte/visual-center

Tool to better align logos in the center of a container.
https://github.com/javierbyte/visual-center

art design design-tool frontend javascript pixel tool visual-center

Last synced: 25 days ago
JSON representation

Tool to better align logos in the center of a container.

Awesome Lists containing this project

README

        

# [Visual Center](https://javier.xyz/visual-center/)

Tool that will find the visual center of your images / logos.

[![visual-center](public/javier-xyz-visual-center.jpg)](https://javier.xyz/visual-center/)

## 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
```

```js
const getVisualCenter = require('visual-center')

getVisualCenter(, function(err, result) {
/*
results in an object with the data as:
{
visualTop:
visualLeft:
bgColor:
width:
height:
}
*/
})
```

## License

BSD-3-Clause License