npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lifesized

v1.0.1

Published

Display things in life size

Downloads

70

Readme

Overview

An Electron module for displaying objects in physically accurate sizes on screens.

Downloadable versions of the Demos are available for Macs.

I hope this module and its uses will convince browser makers to provide this as a native API or at least to Electron in its core

Installation

npm install --save lifesized

Usage

var lifesized = require('lifesized');

// Get the pixels per inch of the display the current render process' BrowserWindow
// is mostly overlayed on
var pixelsPerInch = lifesized.ppi();

See the Demos and their source for a working example.

API

lifesized.ppi(display)

Get the Pixels Per Inch of a display.

  • display (optional*) - The Display who's PPI you want. If not provided it use the display the current BrowserWindow is most over.

Returns: (Number) The displays Pixels Per Inch.

lifesized.scale(objectRealSize, objectPixelSize, display)

Calculate how much you have to scale an object in an image to make it appear life sized on the screen.

  • objectRealSize (Number) Real size of an object in inches
  • objectPixelSize (Number) Size of the object in an image in pixels
  • display (optional*) The Display you want to show the object on. If not provided it use the display the current BrowserWindow is most over.

Returns: (Number) Scale factor to use to scale images (1.0 === 100%)

* Some OSs display windows on multiple displays at once when a Window spans more than one display, some do not. We use the best guest using Electron's screen.getDisplayMatching(rect)

Demos

To run the coins app that shows this off do the following:

  1. Get the code and npm install things

        git clone [email protected]:francoislaberge/lifesized.git
        cd lifesized
        npm Install
  2. Launch the coins demo

        npm run coins
  3. Get some coins and verify that they are the same size in real life as they are on screen.

  1. Run other demos via npm run shaqs-hands or npm run ruler

Limitations

  • Only accurate on OSX right now, falls back to a sane default of 72 pixels/inch (Pull Requests welcome, I will add Windows/Linux support as soon as I can)
  • Doesn't currently detect when a BrowserWindow's Display changes (This should be detectable, will add ASAP)

Contributing

git clone [email protected]:francoislaberge/lifesized.git
cd lifesized
yarn install

See the Todos for planned work if you want to chip in.