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

photosynth-react

v1.0.9

Published

React component for the Temperal PhotoSynth image service

Downloads

5

Readme

PhotoSynth Component for React

This component provides a declarative interface to the PhotoSynth service for rendering images.

Installation

npm i photosynth-react

Setup

A PhotoSynth key is required and may be passed to the component as the prop psKey or set with the environment variable REACT_APP_PHOTOSYNTH_KEY. The latter is preferred to avoid passing in the psKey prop to every instance.

Sign up for a free key at https://temperal.co/

Props

| Name | Range | Default | Type | Description | -------- | ------- | ------- | ----- | ---------- | | adaptiveHistogram | 0 - 100 | | int | Adaptive histogram level of brightening | blur | 0.02 - 20.0 | | float | Blur strength | brightness | 0.0 - 20.0 | | float | Brightness multiplier | bypass | | falsy | boolean | Load sourceUrl directly without using PhotoSynth | cacheBust | | falsy | boolean, string | If true, bust the cache with random query param. If string, use value as the param value. | cropBottomPercent | 1 - 99 | | int | Crop bottom percentage | cropLeftPercent | 1 - 99 | | int | Crop left percentage | cropRightPercent | 1 - 99 | | int | Crop right percentage | cropTopPercent | 1 - 99 | | int | Crop top percentage | format | | webp | FormatType | "avif", "gif", "jpeg", "png", "tiff", "webp" | gamma | 1.0 - 3.0 | 1 | float | Gamma | greyscale | | falsy | boolean | Greyscale (true/false) | height | 1 - 5000 | | int | Generated image height | hue | 0.0 - 180.0 | | float | Hue shift | lightness | 0.0 - 200.0 | | float | Lightness addition | normalizeLower | 1 - 99 | | int | Normalization lower percentile threshold | normalizeUpper | 1 - 99 | | int | Normalization upper percentile threshold | psKey | | | string | PhotoSynth key (Required if REACT_APP_PHOTOSYNTH_KEY not set) | saturation | 0.0 - 20.0 | | float | Saturation level | sharpen | 0.1 - 10.0 | | float | Sharpening level | sourceUrl | | | string | URL of the source image (Required) | width | 1 - 5000 | | int | Generated image width

An additional prop cssStyle may be provided to customize the element's behavior. The value is merged with the default:

{
  backgroundPosition: "center",
  backgroundRepeat: "no-repeat",
  backgroundSize: "contain",
  height: "100%",
  width: "100%",
}

Example

import { PhotoSynth } from "photosynth-react";
...

  <PhotoSynth
    adaptiveHistogram={2}
    blur={0.02}
    brightness={1.0}
    cropBottomPercent={10}
    sourceUrl="https://some.domain/path/to/picture"
    cssStyle={{
      backgroundSize: "cover"
    }}
  />

Note that when width is omitted, the image auto sizes to its container's width.

Usage with other frameworks

The generateUrl() method is exposed and accepts an object with the same keys as documented above. The resulting URL may be passed as the src attribute of the <img> tag or the CSS value background-image: "url(GENERATED_URL)".

Notes

If the image processing fails, the original image URL will be displayed. Please contact support at https://temperal.co with the error details.