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 🙏

© 2026 – Pkg Stats / Ryan Hefner

openseadragon-rails

v1.0.17

Published

Openseadragon support for Rails apps

Downloads

465

Readme

OpenSeadragon Gem Version

OpenSeadragon is a javascript library for displaying tiling images. This gem packages those assets and some Rails helpers for using them.

http://openseadragon.github.io/

Installation

Add the gem to your Gemfile:

gem 'openseadragon'

Run bundle install:

$ bundle install

And run the openseadragon-rails install generator:

$ bundle exec rails g openseadragon:install

The generator will install the Rails helpers and openseadragon assets.

Usage

You must provide the openseadragon npm package as an external dependency.

See https://openseadragon.github.io for further details

Helpers

This gem provides two helpers, #picture_tag and #openseadragon_picture_tag.

picture_tag

The #picture_tag helper creates HTML5 tags.

In the simple case, a view like:

picture_tag 'page1.jpg', 'page2.jpg', 'page3.jpg'

Creates the HTML like:

<picture>
  <source src="page1.jpg" />
  <source src="page2.jpg" />
  <source src="page3.jpg" />
</picture>

You can control the attributes on <picture> and <source> elements:

picture_tag ['page1.jpg' => { id: 'first-picture'}], 'page2.jpg', 'page3.jpg', { class: "picture-image" }, { id: 'my-picture'}
<picture id="my-picture">
  <source class="picture-image" id="first-picture" src="page1.jpg">
  <source class="picture-image" src="page2.jpg">
  <source class="picture-image" src="page3.jpg">
</picture>

openseadragon_picture_tag

If you have an OpenSeaDragon tilesource, you can use this helper to construct a HTML5 <picture> that will render as an OpenSeaDragon tile viewer.

openseadragon_picture_tag 'page1.jpg'
<picture data-openseadragon="true">
  <source media="openseadragon" src="page1.jpg" />
</picture>

This gem includes some javascript that translates that markup to the OSD viewer.

As with #picture_tag, you can provide additional options.

openseadragon_picture_tag 'page1.jpg', 'path/to/info.json', ['some-custom-tilesource' => { Image: {  xmlns: "...", Url: '...', Format: 'jpg', Overlap: 2}}], { class: 'osd-image'}, { data: { openseadragon: { preserveViewport: true, visibilityRatio: 1}}}
<picture data-openseadragon="{&quot;preserveViewport&quot;:true,&quot;visibilityRatio&quot;:1}">
    <source class="osd-image" media="openseadragon" src="page1.jpg" />
    <source class="osd-image" media="openseadragon" src="path/to/info.json" />
    <source class="osd-image" data-openseadragon="{&quot;Image&quot;:{&quot;xmlns&quot;:&quot;...&quot;,&quot;Url&quot;:&quot;...&quot;,&quot;Format&quot;:&quot;jpg&quot;,&quot;Overlap&quot;:2}}" media="openseadragon" src="some-custom-tilesource" />
</picture>

The src attribute (or the JSON-encoded options given in the data-openseadragon) are translated into an OpenSeaDragon tilesource configuration.