Only require IIIF level 1; Vary tile size based on src image when no tiles are reported. Toward openseadragon/openseadragon#313

This commit is contained in:
Jon Stroop 2014-01-02 19:59:10 -05:00
parent e9c2b502c1
commit 24298dcbba
85 changed files with 90 additions and 20 deletions

View File

@ -68,7 +68,7 @@ $.IIIF1_1TileSource = function( options ){
// dimension
var short_dim = Math.min(this.height, this.width),
tile_options = [128,256,512,1024],
tile_options = [256,512,1024],
smaller_tiles = [];
for ( var c = 0; c < tile_options.length; c++ ) {
@ -76,13 +76,20 @@ $.IIIF1_1TileSource = function( options ){
smaller_tiles.push(tile_options[c]);
}
}
options.tileSize = Math.max.apply(null, smaller_tiles);
if ( smaller_tiles.length > 0 ) {
options.tileSize = Math.max.apply(null, smaller_tiles);
} else {
// If we're smaller than 256, just use the short side.
options.tileSize = short_dim;
}
this.tile_width = options.tileSize; // So that 'full' gets used for
this.tile_height = options.tileSize; // the region below
}
if (! options.maxLevel ) {
var mf = -1
; var scfs = this.scale_factors || this.scale_factor;
var mf = -1;
var scfs = this.scale_factors || this.scale_factor;
if ( scfs instanceof Array ) {
for ( var i = 0; i < scfs.length; i++ ) {
var cf = Number( scfs[i] );
@ -165,7 +172,7 @@ $.extend( $.IIIF1_1TileSource.prototype, $.TileSource.prototype, /** @lends Open
uri;
if ( level_width < this.tile_width && level_height < this.tile_height ){
iiif_size = level_width + "," + level_height;
iiif_size = level_width + ",";
iiif_region = 'full';
} else {
iiif_tile_x = x * iiif_tile_size_width;
@ -173,12 +180,7 @@ $.extend( $.IIIF1_1TileSource.prototype, $.TileSource.prototype, /** @lends Open
iiif_tile_w = Math.min( iiif_tile_size_width, this.width - iiif_tile_x );
iiif_tile_h = Math.min( iiif_tile_size_height, this.height - iiif_tile_y );
if( (this.profile &&
this.profile == "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1" ) ){
iiif_size = Math.ceil(iiif_tile_w * scale) + ",";
} else {
iiif_size = Math.ceil(iiif_tile_w * scale) + "," + Math.ceil(iiif_tile_h * scale);
}
iiif_size = Math.ceil(iiif_tile_w * scale) + ",";
iiif_region = [ iiif_tile_x, iiif_tile_y, iiif_tile_w, iiif_tile_h ].join(',');
}

View File

@ -0,0 +1,18 @@
{
"profile": "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",
"height": 870,
"width": 1048,
"qualities": [
"native",
"color",
"grey",
"bitonal"
],
"formats": [
"jpg",
"png",
"gif"
],
"@context": "http://library.stanford.edu/iiif/image-api/1.1/context.json",
"@id": "http://localhost:8000/test/data/iiif_1_1_no_tiles_1048"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 829 B

After

Width:  |  Height:  |  Size: 710 B

View File

@ -0,0 +1,18 @@
{
"profile": "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",
"height": 212,
"width": 255,
"qualities": [
"native",
"color",
"grey",
"bitonal"
],
"formats": [
"jpg",
"png",
"gif"
],
"@context": "http://library.stanford.edu/iiif/image-api/1.1/context.json",
"@id": "http://localhost:8000/test/data/iiif_1_1_no_tiles_255"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 691 B

After

Width:  |  Height:  |  Size: 690 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 B

View File

@ -0,0 +1,18 @@
{
"profile": "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1",
"height": 319,
"width": 384,
"qualities": [
"native",
"color",
"grey",
"bitonal"
],
"formats": [
"jpg",
"png",
"gif"
],
"@context": "http://library.stanford.edu/iiif/image-api/1.1/context.json",
"@id": "http://localhost:8000/test/data/iiif_1_1_no_tiles_384"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1012 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -1,7 +1,7 @@
{
"profile": "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2",
"height": 850,
"width": 1024,
"height": 637,
"width": 768,
"qualities": [
"native",
"color",
@ -14,6 +14,5 @@
"gif"
],
"@context": "http://library.stanford.edu/iiif/image-api/1.1/context.json",
"@id": "http://localhost:8000/test/data/iiif_no_tiles"
"@id": "http://localhost:8000/test/data/iiif_1_1_no_tiles_768"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -24,5 +24,5 @@
"gif"
],
"@context": "http://library.stanford.edu/iiif/image-api/1.1/context.json",
"@id": "http://localhost:8000/test/data/iiif_1_1_files"
"@id": "http://localhost:8000/test/data/iiif_1_1_tiled"
}

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 717 B

After

Width:  |  Height:  |  Size: 717 B

View File

Before

Width:  |  Height:  |  Size: 716 B

After

Width:  |  Height:  |  Size: 716 B

View File

Before

Width:  |  Height:  |  Size: 717 B

After

Width:  |  Height:  |  Size: 717 B

View File

Before

Width:  |  Height:  |  Size: 712 B

After

Width:  |  Height:  |  Size: 712 B

View File

Before

Width:  |  Height:  |  Size: 633 B

After

Width:  |  Height:  |  Size: 633 B

View File

Before

Width:  |  Height:  |  Size: 810 B

After

Width:  |  Height:  |  Size: 810 B

View File

Before

Width:  |  Height:  |  Size: 663 B

After

Width:  |  Height:  |  Size: 663 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 675 B

After

Width:  |  Height:  |  Size: 675 B

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 683 B

After

Width:  |  Height:  |  Size: 683 B

View File

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 KiB

View File

@ -77,12 +77,27 @@
// ----------
asyncTest('IIIF 1.1 JSON', function() {
testOpen('iiif1_1.json');
testOpen('iiif_1_1_tiled.json');
});
// ----------
asyncTest('IIIF No Tiles', function() {
testOpen('iiif_no_tiles.json');
// ----------
asyncTest('IIIF No Tiles, Less than 256', function() {
testOpen('iiif_1_1_no_tiles_255.json');
});
// ----------
asyncTest('IIIF No Tiles, Bet. 256 and 512', function() {
testOpen('iiif_1_1_no_tiles_384.json');
});
// ----------
asyncTest('IIIF No Tiles, Bet. 512 and 1024', function() {
testOpen('iiif_1_1_no_tiles_768.json');
});
// ----------
asyncTest('IIIF No Tiles, Larger than 1024', function() {
testOpen('iiif_1_1_no_tiles_1048.json');
});
})();