Socket
Socket
Sign inDemoInstall

bbox-aspect-ratio

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bbox-aspect-ratio

get aspect ratio from bounding box


Version published
Weekly downloads
21
increased by40%
Maintainers
1
Install size
14.0 kB
Created
Weekly downloads
 

Readme

Source

Bounding Box Aspect Ratio

Calculate aspect ration from bounding box

🔧 Installation

npm i bbox-aspect-ratio

📦 Usage

import { bBoxAspectRatio, calculateSize, SizeType } from "bbox-aspect-ratio";

// Get aspect ratio
const topRight = [76.20742, 11.59426];
const bottomLeft = [76.86794, 11.95073];
const aspectRatio = bBoxAspectRatio([...topRight, ...bottomLeft]);
console.log(aspectRatio); // [1321, 713]

// Calculate size by width
const sizeByWidth = calculateSize(aspectRatio, 50, SizeType.Width);
console.log(sizeByWidth); // 27 → w: 50, h: 27

// Calculate size by height
const sizeByHeight = calculateSize(aspectRatio, 50, SizeType.Height);
console.log(sizeByWidth); // 93 → w: 93, h: 50

FAQs

Last updated on 07 Aug 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc