@gocom/resolution
v0.1.0
Published
Identify pixel resolutions and dimension strings
Maintainers
Readme
Resolution
Identify pixel resolutions, dimension strings and aspect ratios. Offers a library for parsing given pixel resolution values and returning resulting aspect ratios, or human-readable short name identifiers. The main use-case for the library would be to convert raw resolution dimensions to 1080p, 4K and 8K, and other identifiers. Written in TypeScript, and supports both client-side browser and Node.js backend contexts.
⚡ Install
Using npm:
$ npm install @gocom/resolution📖 Documentation
See API Docs.
📝 Example Usage
Parsing resolution dimensions string
The following would parse the given 7680x4320 resolution string, and returns the results as an object:
import {parse} from '@gocom/resolution';
const resolution = parse('7680x4320');
console.log(
resolution?.name, // 8K UHD
resolution?.group, // 8K
resolution?.width, // 7680
resolution?.height, // 4320
resolution?.aspectRatio, // 16:9
resolution?.dimensionRatio, // 1.78
);For more see API documentation.
🛠️ Development
See CONTRIBUTING.md.
🚀 Changes in 0.1.0
- Initial release.
