Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
gasi committed Jan 16, 2020
1 parent 0e0ee7a commit 8e16f2d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ python setup.py install
## Example

```bash
cd deepzoom.py/examples/helloworld/
cd examples/helloworld/

# Single image (DZI)
./helloworld-dzi.py
Expand Down
15 changes: 5 additions & 10 deletions examples/helloworld/helloworld-dzc.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
#!/usr/bin/env python3

import os
from pathlib import Path

import deepzoom


# Collection from local DZIs
images = []
directory = "."
for filename in os.listdir(directory):
if filename.endswith(".dzi"):
images.append(os.path.join(directory, filename))
images = [str(p) for p in Path(".").glob("output/*.dzi")]

creator = deepzoom.CollectionCreator()
creator.create(images, "helloworld-collection.dzc")
creator.create(images, "output/helloworld-collection.dzc")

# Collection from DZIs on the web:
zoomhub_images = [
Expand All @@ -23,7 +18,7 @@
"http://cache.zoom.it/content/8.dzi",
"http://cache.zoom.it/content/h.dzi",
]
creator.create(zoomhub_images, "zoomhub-collection.dzc")
creator.create(zoomhub_images, "output/zoomhub-collection.dzc")

collection = deepzoom.DeepZoomCollection.from_file("helloworld-collection.dzc")
collection = deepzoom.DeepZoomCollection.from_file("output/helloworld-collection.dzc")
print(collection.doc.toprettyxml())
4 changes: 2 additions & 2 deletions examples/helloworld/helloworld-dzi.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import deepzoom

# Specify your source image
SOURCE = f"file://{os.path.abspath('helloworld.jpg')}"
SOURCE = "helloworld.jpg"

# Create Deep Zoom Image creator with weird parameters
creator = deepzoom.ImageCreator(
Expand All @@ -17,4 +17,4 @@
)

# Create Deep Zoom image pyramid from source
creator.create(SOURCE, "helloworld.dzi")
creator.create(SOURCE, "output/helloworld.dzi")

0 comments on commit 8e16f2d

Please sign in to comment.