プロジェクト
GitHubで見る
javierbyte/visual-center
概要
コンテナ内でロゴをよりきれいに中央揃えするためのツール。
デザイン・メディア計測したスター増加
- 24時間
- 0
- 7日間
- +1
- 15日間
- +1
- 1か月
- +1
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルVisual Center
Tool that will find the visual center of your images / logos.
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.
pnpm add visual-center
const getVisualCenter = require('visual-center')
getVisualCenter(<imgSrc>, 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>
}
*/
})
License
BSD-3-Clause License
Made by Javier Bórquez. Online since 2016.
関連プロジェクトを探す
読み込み中…
