Socket
Socket
Sign inDemoInstall

guess-image-layout

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    guess-image-layout

Guess the Layout of Image Pixels. Returns layout in xdim layout syntax.


Version published
Weekly downloads
4.2K
decreased by-6.76%
Maintainers
1
Install size
20.7 kB
Created
Weekly downloads
 

Readme

Source

guess-image-layout

Guess the Layout of Image Pixels. Returns layout in xdim layout syntax.

install

npm install guess-image-layout

basic usage

import guessImageLayout from "guess-image-layout";

const rgba = [123, 234, 42, 255, 124, 42, 42, 255, ...];
guessImageLayout({ data: rgba, bands: 4, height: 768  });
// { layout: "[row,column,band]", bands: 4, height: 768, width: 1024 }

const bands = [
  [123, 124, ...], // red band
  [234, 42, ...], // green band
  [42, 42, ...], // blue band
  [255, 255, ...] // alpha band
];
guessImageLayout({ data: bands });
// { layout: "[band][row,column]", bands: 4, height: undefined, width: undefined }

advanced usage

If you already know the array of layout of the data, you can pass that in and it will calculate what it can.

import guessImageLayout from "guess-image-layout";

const rgba = [123, 234, 42, 255, 124, 42, 42, 255, ...];

guessImageLayout({ data: rgba, layout: "[band][row,column]" })
// { "bands": 4, "layout": "[band][row,column]", height: undefined, width: undefined }

Keywords

FAQs

Last updated on 25 Jun 2022

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