1. Skip to navigation
  2. Skip to content
  3. Skip to sidebar


Welcome to the GigaPan Forum!

This is the place for Gigapan.com members to offer peer-to-peer support for exchanging tips, ideas, comments, etc.

Those who need direct technical assistance with their GigaPan EPIC Series imagers, stitching software or gigapan.com membership account should contact us.

Forums » api.gigapan.org » API JPG dimensions

API JPG dimensions
Ron Schott Ron Schott
Total Posts: 89

It would appear that somebody jiggered with the API recently so that the pixel dimensions of output JPGs no longer match those input via the URL. For example: http://api.gigapan.org/beta/gigapans/104010-200… is currently returning a JPG image with pixel dimensions 1584×396.

Please fix this so it works properly again.

Gabriel O'Donnell Gabriel O&#...
Total Posts: 11

Your image should render now. The max height was not set to an appropriate value.

Jason Buchheim Jason Buchheim
Total Posts: 86

If you query the api with the widths and heights set to the correct aspect ratio, it will return a thumbnail without any padding. The thumbnail api is designed for delivering the images on the Gigapans list pages, whose thumbnails have a maximum height of 360 pixels. The Gigapan list pages use some JavaScript code to compute how big of an image to request – it is not hard coded into the pages html. Each list page result gets updated in the browser via ajax magic to show an image of the proper resolution for the window width of the calling browser (thus reducing download time on small screen devices or window widths).

The Gigapan data api is publicly accessible, you may query the api with JavaScript or php to get the image width and height (as well as all the Gigapans pertinent data), then do your math, and output your desired result. For instance, for your image, the new api address would be http://www.gigapan.com/gigapans/104010.json . If using javascript, you can use jquery library to easily request and decode the data into javascript variables, but you will need to use the OLD api, as javascript requires the data to be wrapped in a function (JSONP format) to access the data cross domain. [The new api address does not support JSONP…] The old api address is http://api.gigapan.org/beta/gigapans/104010.json. Returned data includes the Gigapans width and height, then do your math to get the aspect ratio (width/height), set your thumb height at 360 pixels and multiply 360 by your aspect ratio result to get your width, and you will get your image without the ugly black padding bars (e.g. http://api.gigapan.org/beta/gigapans/104010-168…)

The max thumbnail width is now 2000 pixels (for a while the api would actually return jpgs of any requested width!!!)

Here is a simple php script that will output a page with the Gigapans thumbnail 360 pixels tall and spit out a list of other dimensions with the proper aspect ratio. (just change the id in the address to match your Gigapans id)


source: http://www.3d-360.com/gigathumb.php.txt



PS. In a nutshell, visit this page with your Gigapans ID to get your proper thumbnail dimensions:
http://www.3d-360.com/gigathumb.php?id=66615 (change the 66615 to match your Gigapan ID)

Ron Schott Ron Schott
Total Posts: 89

Says Jason: “The max thumbnail width is now 2000 pixels (for a while the api would actually return jpgs of any requested width!!!)”

And I had been taking good advantage of the wider widths – I have a dual monitor setup where each screen has a width of 2048 pixels – coincidentally, the maximum width Google+ will allow image uploads without costing one for storage space. Also, it was very convenient to be able to return large JPG images (say 10000×2000 pixels) so that I could crop out sections at high resolution in Photoshop – much easier than having to restitch an image and save the Tiff or Photoshop RAW to do the same thing.

Capping the width of JPGs from the API thus breaks a feature of the API as far as I’m concerned, so in my view the issue is not fixed.

[As long as I can get arbitrarily large images via the API it’s actually easier for me to crop what I need in Photoshop than to use the JSON API to calculate the proper proportional dimensions – in most cases I want to trim the ragged edges off anyhow, so bigger black bars don’t bother me in the least.]

Jason Buchheim Jason Buchheim
Total Posts: 86

Well, I did not know what you wanted the thumbnails for, but 10000×2000 is hardly a thumbnail;)

Jason Buchheim Jason Buchheim
Total Posts: 86

So I could not resist myself, I thought, could this tile composting be done in a javascript <canvas> tag entirely in the browser? So I came up with this image pyramid render-er for a very large canvas. Seems my browser could only handle a canvas width of 8000 pixels, so I set this as the upper limit. This is rendered entirely in javascript, use it sparingly as it requests all tiles for a width of 8000 pixels image. Its 4x larger than the api offers.

Ron Schott Ron Schott
Total Posts: 89

That’s great, Jason! Do you mind if I hack (ethically) your JavaScript renderer to play around with this on my own site? I’ve been meaning to explore whether the <canvas> tag would provide an HTML5 compatible way of rendering GigaPans (especially for non-Flash capable devices) – I see now that you’re way ahead of me (as usual).

Jason Buchheim Jason Buchheim
Total Posts: 86

Ron, of course you may hack! But dont start there, start at http://www.stereopan.com/ipan, it already works as a general purpose renderer!

The image pyramid render-er is open source. It works wonderfully on the desktop and iOS devices. It has better speed than Seadragon, but missing much of its animation and inclusion technology [ie. layers on top] (how much can you expect out of 600 lines of javascript?) It only works well on HTML5 hardware accelerated <canvas> browsers (all modern incarnations work well- ie, safari, opera, firefox, chrome) The coding is soo efficient, it should only take 3 months to wrap your head around it entirely and understand its magic (that was my timeframe at least).

Forums» api.gigapan.org » API JPG dimensions