如何将元数据与 DeepZoom SubImage 关联?

发布于 2024-07-11 10:49:14 字数 242 浏览 4 评论 0原文

我正在尝试根据与每个图像关联的任意数据对 DeepZoom 子图像的集合进行排序。 子图像通过 DeepZoom Composer 生成的 XML 文件自动加载。 我没有看到将任意数据与 DeepZoom 子图像相关联的明确方法。

对我来说最明显的解决方案是脆弱的并且不能很好地扩展。 理想情况下,我希望将相关数据放入生成的 XML 文件中,但我会在下一组生成的图像中丢失该信息。

是否有一个完善的方法来实现这个目标?

I'm trying to sort through a collection of DeepZoom sub-images based on arbitrary data associated with each image. The sub-images get loaded automagically through an XML file generated by DeepZoom Composer. I don't see a clear way to associate arbitrary data with a DeepZoom sub-image.

The solutions that seem most obvious to me are brittle and don't scale well. Ideally, I'd like to put the relevant data in the generated XML file, but I'd lose that information on the next set of generated images.

Is there a well-established way of accomplishing this goal?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

醉殇 2024-07-18 10:49:14

正如您所注意到的,DeepZoomComposer 支持 元素,您可以在 Silverlight MultiScaleImage 控件中使用该元素 (按标签过滤示例)。

您也是对的,当您在 DeepZoomComposer 中编辑并重新生成时,您将“丢失”添加到 XML 文件中的任何信息(但是,如果您在 DeepZoomComposer 中输入,则不会丢失它)。

为了解决这个问题,我编写了一个名为 TagUpdater 的小控制台应用程序 - 基本上就是 工作方式如下

  1. 您将元数据放入图像中:JPG 文件格式支持许多不同的字段,但现在让我们使用标题、关键字(标签)、描述和评级

  2. 您将图像添加到 Microsoft 的 DeepZoomComposer(不必费心布置它们,因为您可能想要动态对它们进行排序;并且不必费心输入任何元数据)并导出照常

  3. 通过控制台调用 TagUpdater.exe Metadata.xml (DeepZoomComposer 将生成 Metadata.xml 文件)。

TagUpdater 直接从图像中提取元数据并更新 Metadata.xml(见下文)。 它会破坏现有的 数据,但除此之外,该文件可以像以前一样使用,为 MultiScaleImage 控件中的 DeepZoom 集合提供元数据信息。

<Image>
<FileName>C:\Documents and Settings\xxxxxx\My Documents\Expression\Deep Zoom Composer Projects\Bhutan\source images\page01.jpg</FileName> 
<x>0</x> 
<y>0</y> 
<Width>0.241254523522316</Width> 
<Height>0.27256162721473</Height> 
<ZOrder>1</ZOrder> 
<Tag>Bhutan,Mask</Tag> 
<Description>Land of the Thunder Dragon</Description> 
<Title>Bhutan 2008</Title> 
<Rating>3</Rating> 
</Image>

您可以继续添加图像/重新生成,因为元数据来自图像(而不是 DeepZoomComposer 标签框)。

这是示例 - 请注意,当您将鼠标悬停在每个标签和描述上时,右侧的标签和描述会如何更新图像,以及根据单击标签过滤的可见图像。

Kirupa 的源可以修改以使用这些额外的数据...

string tagString = g.Element("Tag").Value;
// get new elements as well
string descriptionString = g.Element("Description").Value;
string titleString = g.Element("Title").Value; 
string ratingString = g.Element("Rating").Value; 

希望这会引起一些兴趣 - TagUpdater 本身并不是实现此目的的唯一方法。 它非常简单:它只是打开 Metadata.XML 文件,循环遍历 元素以打开 ,提取元数据,添加附加信息XML 元素并保存 XML。 使用文件名作为“键”,您可以从数据库中获取附加信息(例如价格或更多描述数据),并根据需要扩展 XML 文件。

As you've noticed DeepZoomComposer supports a <Tag></Tag> element which you can use in your Silverlight MultiScaleImage control (filtering by tag example).

You are also right that you would 'lose' any information you add to the XML file when you edit in DeepZoomComposer and re-generate (however you don't lose it if you typed into DeepZoomComposer).

To get around this problem, I've written a little console application called TagUpdater -- basically it works like this:

  1. You put your metadata IN THE IMAGES: JPG file format supports lots of different fields, but for now let's use Title, Keywords (tags), Description and Rating

  2. You add your images to Microsoft's DeepZoomComposer (don't necessarily bother laying them out, since you will probably want to sort them dynamically; and don't bother entering any metadata) and Export as normal

  3. Call TagUpdater.exe Metadata.xml via the console (DeepZoomComposer will have generated the Metadata.xml file).

TagUpdater extracts the metadata direct from your images and updates Metadata.xml (see below). It is destructive to the existing <Tag> data, but otherwise the file can be used as-before to provide metadata information for a DeepZoom collection in a MultiScaleImage control.

<Image>
<FileName>C:\Documents and Settings\xxxxxx\My Documents\Expression\Deep Zoom Composer Projects\Bhutan\source images\page01.jpg</FileName> 
<x>0</x> 
<y>0</y> 
<Width>0.241254523522316</Width> 
<Height>0.27256162721473</Height> 
<ZOrder>1</ZOrder> 
<Tag>Bhutan,Mask</Tag> 
<Description>Land of the Thunder Dragon</Description> 
<Title>Bhutan 2008</Title> 
<Rating>3</Rating> 
</Image>

You can keep adding images/regenerating because the metadata is coming from the images (not the DeepZoomComposer tag box).

Here's an example - notice how the tags and description on the right are updated as you hover over each image, as well as the visible images being filtered based on clicking a tag.

Kirupa's source can be modified to use this extra data...

string tagString = g.Element("Tag").Value;
// get new elements as well
string descriptionString = g.Element("Description").Value;
string titleString = g.Element("Title").Value; 
string ratingString = g.Element("Rating").Value; 

Hope that's of some interest - TagUpdater itself isn't the only way to accomplish this. It's pretty simple: it just opens the Metadata.XML file, loops through the <Image> elements to open the <FileName>, extract the metadata, add the additional XML elements and save the XML. Using the filename as a 'key' you could get additional information from a database (eg. a price or more description data) and expand the XML file as much as you want.

若相惜即相离 2024-07-18 10:49:14

Metadata.xml 有一个可以与每个图像关联的 Tag 属性。 欢呼!

Metadata.xml has a Tag property that can be associated with each image. Hurray!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文