Biodiversity Heritage Library - Program news and collection highlights from BHL
  • Home
  • News
  • Featured Books
    • All Featured Books
    • Book of the Month Series
    • BHL at 20
  • User Stories
  • Campaigns
    • Fossil Stories
    • Garden Stories
    • Monsters Are Real
    • Page Frights
    • Her Natural History
    • Earth Optimism 2020
  • Tech Blog
  • Visit BHL
Home
News
Featured Books
    All Featured Books
    Book of the Month Series
    BHL at 20
User Stories
Campaigns
    Fossil Stories
    Garden Stories
    Monsters Are Real
    Page Frights
    Her Natural History
    Earth Optimism 2020
Tech Blog
Visit BHL
  • Home
  • News
  • Featured Books
    • All Featured Books
    • Book of the Month Series
    • BHL at 20
  • User Stories
  • Campaigns
    • Fossil Stories
    • Garden Stories
    • Monsters Are Real
    • Page Frights
    • Her Natural History
    • Earth Optimism 2020
  • Tech Blog
  • Visit BHL
Biodiversity Heritage Library - Program news and collection highlights from BHL
BHL News, Blog Reel, Tech Updates

Image Sizes in BHL. SEE ALSO: Piece of String, Length of.

Portrait version of the Biodiversity Heritage Library logo.

“How long is a piece of string?” isn’t a familiar idiom to those living in the Midwest of the continental United States. Well, it wasn’t to at least one person living in the Midwest. It’s the answer you’ll get in the BHL AU office to questions like “How long does it take to build a website?” or any other question to which there isn’t a definitive answer for the general case, like “How big is a page image in BHL?”

Of course another way of answering would be “It depends”. To take two completely random examples, this page from Prodromus of the zoology of Victoria is 1828 pixels wide by 2879 pixels high. This page from Australian Lepidoptera and their transformations is 3496 pixels wide by 4785 pixels high.

Now, I’m sure you’ve gotten familiar with BHL’s API while you’ve been putting together your entry for the Life and Literature code challenge. I know you’re working hard on your entry, ‘cause it’s what all the other cool kids are doing.

You don’t need me to tell you that when you use the API to get an item’s metadata with the page flag set to true, you get a url for a thumbnail image and an url for the full size of each page. Which is fantastic, if you want an image that will fit into a 200px by 300px box, or an IOUS (image of unusual size). What if you want an images that will fit into a 600px by 800px box? Do you get the thumbnail and scale it up? Yes, but only if you’re doing it in a bad police procedural that creates image information from nowhere. In the real world, you need to get the full size image and downsize it. Until now.

Now you can get your Astacoides serratus at a range of sizes to suit your budget. Simply add the width and height of your bounding box at the end of the thumbnail image url, and Bob’s your uncle. So, if you want an image to fit into a 600px by 800px box, instead of using the thumbnail url as is (http://bhl.ala.org.au/pagethumb/5221137), use http://bhl.ala.org.au/pagethumb/5221137,600,800 and you’ll get back an image that’s exactly 914px by 1440px.

Okay, I know that a 914px by 1440px image doesn’t fit into a 600px by 800px box. You’re still going to have to scale the image down to 508px by 800px to fit, but at least you only have to download a third of the information compared to the full size image (148kB vs 436kB). So why aren’t we providing an image of A. serratus at 508px by 800px?

Rather than have the server scale the full size image for each request, images are available at fixed fractions of the original dimensions. The fractions available are a half, a quarter, an eighth and a 16th. Those are fractions of the width and height, so each step down has only a quarter as many pixels as the one before.

The server will give you the smallest image available that won’t need to be scaled up to fit within your bounds. So, using our old mate A. serratus as the example, if you specified a bounding box of 915px x 1441px, you’d get the full size image at 1828px x 2879px. If you don’t provide a width and height, the assumed size of the bounding box is 200px by 300px.

 

I’ve got to be honest, while all the links point to the Australian node, the heavy lifting for this was done by the good folks at http://www.biodiversitylibrary.org/. You can replace bhl.ala.org.au with www.biodiversitylibrary.org and get exactly the same results.

Have fun playing with the images, and I look forward to seeing how you put it to good use.

October 11, 2011by chad.nelson

Help Support BHL

BHL's existence depends on the financial support of its patrons. Help us keep this free resource alive!

search

About BHL

The Biodiversity Heritage Library (BHL) is the world’s largest open access digital library for biodiversity literature and archives. BHL operates as a worldwide consortium of natural history, botanical, research, and national libraries working together to digitize the natural history literature held in their collections and make it freely available for open access as part of a global “biodiversity community.”

Join Our Mailing List

Sign up to receive the latest news, content highlights, and promotions.

Subscribe Now

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 319 other subscribers

Subscribe to Blog Via RSS

Subscribe to the blog RSS feed to stay up-to-date on all the latest BHL posts.

Access RSS Feed

Inspiring Discovery through Free Access to Biodiversity Knowledge.

The Biodiversity Heritage Library makes it easier than ever for you to access the information you need to study and explore life on Earth…for free, anytime, anywhere.

 

64+ Million Pages of
Biodiversity Literature Online.

EXPLORE

Tools and Services
to Transform Research.

EXPLORE

300,000+
Illustrations on Flickr.

EXPLORE

ABOUT | HARMFUL CONTENT | PRIVACY | SITE MAP | TERMS OF USE