-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image service helper. #22
Comments
Just to say that I'd love to see this as a feature! Is there already code in the works? FWIW: for our IMMARKUS annotation platform, I have implemented a Web Worker crop utility that I'm using to crop snippets from images stored locally, or fetched from IIIF Simple Image-type manifests (provided that CORS is enabled on the server). I have not yet attempted to do stitching of Level 0 tiles, but this may become a requirement for IMMARKUS eventually. In case it's useful: |
Oh that nice! So the web worker serves them as if they were images. Sounds similar to the stitching, perhaps those use-cases could be grouped together into a library on top. Really interesting approach using the web worker. |
Exactly, the web worker serves the result as a data array, and that can then be displayed as a data URL, roughly like so: <img src={URL.createObjectURL(new Blob([snippet.data]))} /> |
A new generic helper for image services and canvases to resolve real, working thumbnails at a particular size, with fallbacks.
Some notes:
Ability to generate "virtual" images, for example from level0 tiles.
Which would be compatible with cropping:
Can pass a function to try, for custom logic. Should return
{url, height, width}
Draft of try options:
Size priority.
Still need a bit more thought. When you request a size:
There will only be one possible output, from the image service.
!256,256
or eqv.However, if you request a range of sizes:
Then it could look for tiles and sizes that are suitable first. So if you added:
largest-size
And the sizes array was:
Then it would return
/725,1000/
image request. However, if you set it tosmallest-size
then{"width":290,"height":400}
would be returned.closest-size
only works if you also provide a height and width:This would return
{"width":145,"height":200}
. The "area" is the closest value.200x200
- 40,000 <- target73x100
- 7,300145x200
- 29,000 <- closest290x400
- 116,000724x1000
- 724,000The options:
smallest-possible
andlargest-possible
work the same aslargest-size
andsmallest-size
for level0 image services, but for level1 and level2 they will return either the max or minimum size specified with a!w,h
request.The text was updated successfully, but these errors were encountered: