Skip to content

Fasust/HighResImage-to-DeepZoomImage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HighResImage-to-DeepZoomImage

NodeJS Service that converts high resolution images to a Deep Zoom Image Tree

I am using the node module Sharp to cut large images into the DZI (Deep Zoom Image) Format. This service could be used in conjunction with Open Sea Dragon to create Deep Zoom Images on the Web.

Examples of Deep Zoom Images on the Web.

A large JPG you can use to test this service.

Setup

git clone https://github.com/Fasust/HighResImage-to-DeepZoomImage.git
npm install
npm start 

The console should say: "[LOG] Opened Service on Port: 3000"

Endpoints

The service has 2 end-points

End Point HTTP Verb Use Request Response
/ POST Convert an attached img to DZI format Needs an attached file A zip file containing the DZI image, it is send via a stream
/download-test GET Download the last converted DZI zip can be empty A zip file containing the DZI image, it is send via a stream

The DZI Zip files are very large in size. Especially when the service converts a large Image. That is why I am using streams as a response type instead of sending the entire file at once.

Structure of the DZI zip file

output.zip
|
output
|
├── output.dzi      //Deep Zoom XML definition
└── output_files    //Contains 512x512 tiles grouped by zoom level
    ├── 0
    |   └── 0_0.png
    ├── 1
    |   └── ...
    ├── 2
    |   └── ...
    └── ...

How to Request

//Node Modules
const request = require('request');
const fs = require('fs');

//Build the Form to Attach to the Post
const formData = {
    file: fs.createReadStream(__dirname + '/test-input.jpg') //Load img as buffer
}

//send Post
request.post({ url: 'http://localhost:3000/', formData: formData })
    .pipe(fs.createWriteStream('dzi.zip')); //write response stream to zip file

Releases

No releases published

Packages

No packages published