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

stereo-img

v1.18.0

Published

a web component to display stereographic pictures on web pages, with VR support

Downloads

75

Readme

<stereo-img>

<stereo-img> is a web component to display stereographic pictures on web pages, with VR support. It supports various stereo picture formats: VR Photos (VR180, Google Camera panorama, Photosphere), left-right, and anaglyph.

See the demo for an example.

How to use

Load the module:

<script type="module" src="https://stereo-img.steren.fr/stereo-img.js"></script>

Then use the <stereo-img> custom element anywhere in your page or app, reference a stereo picture in the src attribute:

<stereo-img src="picture.vr.jpg"></stereo-img>

Alternatively, you can serve the module from your own server, install it via npm:

npm install stereo-img

Attributes

  • src: (Required) source of the stereo picture (absolute or relative)
  • type: (Optional) type of stereo picture:
    • If unset, type is inferred from heuristics
    • vr: VR Photo - VR180, Google Camera panorama, Cardboard Camera, Photosphere images (Where right eye image and angle of view info are embedded in the image metadata)
    • left-right: left eye on the left, right eye on the right, Exif angle of view is used if present.
    • right-left: left eye on the right, right eye on the left, Exif angle of view is used if present.
    • top-bottom: left eye on the top, right eye on the bottom, Exif angle of view is used if present.
    • bottom-top: left eye on the bottom, right eye on the top, Exif angle of view is used if present.
    • anaglyph: Anaglyph 3D - currently only supporting red / green
  • angle: (Optional) hint at angle of view for left-right or top-bottom types
    • If unset, Exif angle of view is used if present.
    • 180: Half sphere (VR180)
    • 360: Full sphere
  • projection: (Optional) hint at projection (most VR pictures use equirectangular projection)
    • If unset, projection is inferred from heuristics.
    • fisheye: Fisheye projection
  • wiggle: (Optional) When viewing in 2D, alternate between left and right images to help the user see the 3D effect
    • enabled: wiggle is enabled
    • disabled: wiggle is disabled

Compatibility

Supported cameras

This component has been manually tested to load pictures taken with the following cameras:

| Status | Camera | Picture type | Attributes required | Field of view | Orientation | | ------ | ----------------------------------- | ------------------- | ------------------------------------- | ------------- | ----------- | | ✔️ | Lenovo Mirage Camera | unprocessed (VR180) | (none) | ✓ | ✓ | ✔️ | Canon RF5.2mm F2.8 L Duel Fisheye | unprocessed | (none) | X | X | ✔️ | Canon RF5.2mm F2.8 L Duel Fisheye | processed with EOS VR Utility | (none) | X | X | ✔️ | CALF VR180 | left-right | (none) | X | X | ✔️ | CALF VR180 | "vr180" | angle="180" | X | X | ✔️ | Kandao QooCam EGO 3D Camera | left-right | (none) | X | X | ❌ | Vision Pro | | | |

Viewers and headsets

This component has been manually tested on the following hardware, OS and browsers:

| Hardware | OS | Browser | Status | | ----------- | ------- | --------------- | ------ | | HTC Vive | Windows | Chrome | ✔️ | HTC Vive | Windows | Firefox | ✔️⚠️ With WebXR polyfill | HTC Vive | Windows | Firefox Reality | ✔️ | Cardboard | Android | Chrome | ✔️ | Cardboard | Android | Firefox | ❌ | Cardboard | iOS | | ❌ #18 | Quest 1 | | Default | ✔️ | Quest 2 | | Default | ✔️️ | Vision Pro | | Safari | ❌ #34

Installing using npm

Instead of a CDN, you can install the module locally using npm:

npm install stereo-img

Then, use a JavaScript builder or import-maps to load the module and its dependencies:

If using import-maps:

<!-- Shim for importmap -->
<script async src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script>
<script type="importmap">
  {
    "imports": {
      "stereo-img": "./node_modules/stereo-img/stereo-img.js",
      "exifr": "./node_modules/exifr/dist/full.esm.js",
      "three": "./node_modules/three/build/three.module.js",
      "three/": "./node_modules/three/"
    }
  }
</script>

Then load the stereo-img module:

<script type="module">import "stereo-img";</script>

Contributing

See development instructions and contribution guidelines