Skip to content

Commit

Permalink
Imagebox3 class-ified
Browse files Browse the repository at this point in the history
  • Loading branch information
PrafulB committed Feb 25, 2024
1 parent c75435a commit bac2490
Show file tree
Hide file tree
Showing 3 changed files with 369 additions and 281 deletions.
16 changes: 8 additions & 8 deletions demo/esm/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import imagebox3 from "../../imagebox3.mjs"
import Imagebox3 from "../../imagebox3.mjs"

const imgBox = {}

Expand Down Expand Up @@ -98,13 +98,13 @@ imgBox.loadTile = async ({fileURL, tileX, tileY, tileWidth, tileHeight, tileSize
tileSizeElement.value = tileSize
}

tileElement.src = URL.createObjectURL(await (await imagebox3.getImageTile(decodeURIComponent(fileURL), {
tileX,
tileY,
tileWidth,
tileHeight,
tileSize
}, 1)).blob())
if (imgBox.image?.getImage() !== decodeURIComponent(fileURL)) {
const numWorkers = 4
imgBox.image = new Imagebox3(decodeURIComponent(fileURL), numWorkers)
await imgBox.image.init()
}

tileElement.src = URL.createObjectURL(await (await imgBox.image.getTile(tileX, tileY, tileWidth, tileHeight, tileSize)).blob())
tileElement.onload = () => {
URL.revokeObjectURL(tileElement.src)
}
Expand Down
2 changes: 1 addition & 1 deletion imagebox3.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ var imagebox3 = (() => {
let tiff = {} // Variable to cache GeoTIFF instance per image for reuse.
const imageInfoContext = "http://iiif.io/api/image/2/context.json"

const decodersJSON_URL = `http://localhost:8081/decoders/decoders.json`;
const decodersJSON_URL = `https://episphere.github.io/imagebox3/decoders/decoders.json`;

let supportedDecoders = {};
fetch(decodersJSON_URL).then(resp => resp.json()).then(decoders => {
Expand Down
Loading

0 comments on commit bac2490

Please sign in to comment.