代码
# svs_split.py
import pyvips
import sys
filepath = sys.argv[1]
img = pyvips.Image.new_from_file(filepath, access='sequential')
series = filepath[0:len(filepath) -3]
img.dzsave(series)
python svs_split.py test.svs
执行以上代码后,会生成两份文件,分别是:test.dzi,test_files,前者是单个文件,后者是一个文件夹
注意:
需要下载vips库,解压到同一级目录
https://github.com/libvips/libvips/releases
https://github.com/libvips/libvips/releases/download/v8.10.5/vips-8.10.5.tar.gz
web查看工具
https://openseadragon.github.io/#download
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<title>OpenSeadragon_Demo0</title>
<script src='../openseadragon.min.js'></script>
</head>
<body>
<div id='openSeadragon1' style='width:1850px; height:960px;'></div>
</body>
<script type='text/javascript'>
OpenSeadragon({
id: 'openSeadragon1',
prefixUrl: '../images/',
tileSources: {
Image: {
xmlns: 'http://schemas.microsoft.com/deepzoom/2008',
Url: './test_files/',
Overlap: '1',
TileSize: '254',
Format: 'jpeg',
Size: {
Height: '32893',
Width: '46000'
}
}
}
});
</script>
</html>