开发者

Displaying own gigapixel images in DeepZoom using silverlight

开发者 https://www.devze.com 2023-02-14 23:12 出处:网络
I actually use my own code to produce the images(tiles)at different layers of the pyramid (oneswhich are otherwise produced by deepzoom composer).I want to k开发者_如何转开发now if it is possible to l

I actually use my own code to produce the images(tiles)at different layers of the pyramid (ones which are otherwise produced by deepzoom composer).I want to k开发者_如何转开发now if it is possible to load them in silverlight? usually on the net I have seen images exported out of deep zoom composer for this and hence the question.


For a single large image its reasonably easy if you already have the pyramid set of tile images for the image.

The Xml

Create yourself a sub-folder (under ClientBin usually) to contain your set of large images (lets just call it "Content" for this example). Create in this folder an Xml file to describe your deepzoom image, for this example "MyLargeImage1.xml". Use this following Xml:-

<?xml version="1.0" encoding="utf-8"?>
<Image TileSize="256" Overlap="1" Format="jpg" xmlns="http://schemas.microsoft.com/deepzoom/2008">
    <Size Width="40000" Height="30000" />
</Image>

Note the TileSize attribute indicates the side length of the tiles that you have used. Hence if you have used a different tile size in creating your pyramid then you should adjust this value. Note also Overlap, this indicates by how many pixels each tile may overlap, if you haven't used any overlap in your tiling set this value of 0.

Specify the actual pixel dimensions of your image in the Size element.

The Image Files

Now in the same folder as this Xml file create a folder with the same title but with the suffix "_files". In this case a folder called "MyLargeImage1_files". Its in this folder that we have a series of sub folders representing the pyramid layers.

In the case of a Gigapixel image (such as with the dimensions I have used above) you would have 17 folders, named from "0" to "16". Since you would need to down to level 16 to view such an image at its native resolution.

Each of these folders you would contain the set of tiles that make up this layer in the pyramid. These are .jpg files with a file title of the form "x_y" where x and y are the tiles ordinal position in the x and y axis, where 0_0 is the top left tile.

In this example all folders upto and including "8" would contain a single 0_0.jpg file since its only above level 8 would we find images larger than the 256 limit for a single tile that is specified in the Xml. Of course if you have used a different tile size then this will differ for you.

By level "16" you would expect to have all files from 0_0.jpg to 156_117.jpg (18526 files is a lot of files for single folder).

The Xaml

Finally to actually display the image you use the MultiScaleImage control and point its source property at the xml file:-

<MultiScaleImage Source="/Content/MyLargeImage1.xml" />
0

精彩评论

暂无评论...
验证码 换一张
取 消