使用 silverlight 在 DeepZoom 中显示自己的十亿像素图像
我实际上使用自己的代码在金字塔的不同层生成图像(图块)(由 Deepzoom Composer 生成的图像)。我想知道是否可以在 silverlight 中加载它们?通常在网上,我看到过从深度缩放编辑器中导出的图像,因此出现了这个问题。
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 know 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于单个大图像,如果您已经拥有该图像的平铺图像的金字塔集,则相当容易。
Xml
为自己创建一个子文件夹(通常在 ClientBin 下)来包含一组大图像(在本示例中,我们将其称为“Content”)。在此文件夹中创建一个 Xml 文件来描述您的 deepzoom 图像,在此示例中为“MyLargeImage1.xml”。使用以下 Xml:-
请注意,
TileSize
属性指示您所使用的图块的边长。因此,如果您在创建金字塔时使用了不同的图块尺寸,那么您应该调整该值。另请注意重叠
,这表示每个图块可以重叠的像素数,如果您在平铺中没有使用任何重叠,则将此值设置为 0。在<中指定图像的实际像素尺寸代码>大小元素。
图像文件
现在,在与此 Xml 文件相同的文件夹中创建一个具有相同标题但后缀为“_files”的文件夹。在本例中,文件夹名为“MyLargeImage1_files”。在这个文件夹中,我们有一系列代表金字塔层的子文件夹。
对于十亿像素图像(例如我上面使用的尺寸),您将有 17 个文件夹,名称从“0”到“16”。因为您需要降低到 16 级才能以其原始分辨率查看此类图像。
每个文件夹都将包含构成金字塔中这一层的图块集。这些是 .jpg 文件,文件标题的形式为“x_y”,其中 x 和 y 是图块在 x 和 y 轴上的顺序位置,其中 0_0 是左上角图块。
在此示例中,直到“8”(包括“8”)的所有文件夹都将包含一个 0_0.jpg 文件,因为只有在级别 8 以上,我们才会发现大于 Xml 中指定的单个图块 256 个限制的图像。当然,如果您使用了不同的瓷砖尺寸,那么这对您来说会有所不同。
到“16”级,您将期望拥有从 0_0.jpg 到 156_117.jpg 的所有文件(18526 个文件对于单个文件夹来说是很多文件)。
Xaml
最后,要实际显示图像,请使用
MultiScaleImage
控件并将其源属性指向 xml 文件:-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:-
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 alsoOverlap
, 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:-