C#:dzi图像创建opensedragon

本文关键字:创建 opensedragon 图像 dzi | 更新日期: 2023-09-27 18:29:21

我有一个关于dzi图像创建的问题。我使用以下代码在C#中生成dzi图像。

public string GetGenetatedImage()
{
    ImageCreator creator = new ImageCreator();
    creator.TileFormat = ImageFormat.Png;
    creator.TileOverlap = 1;
    creator.TileSize = 256;
    string RootPath = HttpContext.Current.Server.MapPath("~/Images/new.png");

    List<string> files = new List<string>()
    {               
       RootPath
    };
    string root = HttpContext.Current.Server.MapPath("~/Images/GeneratedImagesnewGrid/");

    List<string> dzi = new List<string>();
    foreach (var name in files)
    {
        string output = Path.Combine(root, Path.GetFileNameWithoutExtension(name) + ".dzi");
        dzi.Add(output);
        creator.Create(name, output);
    }
    CollectionCreator ccreator = new CollectionCreator();
    ccreator.TileFormat = ImageFormat.Png;
    ccreator.TileOverlap = 1;
    ccreator.TileSize = 256;
    ccreator.Create(dzi, Path.Combine(root, "da.dzc"));
    string rtvalue = HttpContext.Current.Server.MapPath("~/Images/GeneratedImagesLighthouse/newGrid.dzi");
    return rtvalue;
}

我正在使用DeepZoomTools。

我的输入文件在这里

我获得的输出在这里

我的输出文件似乎缺少文件

客户端代码:

   OpenSeadragon({
                    id:             "example-zoomit-tilesource",
                    prefixUrl:       "openseadragon/images/",
                    defaultZoomLevel:        1,
                    minZoomLevel:         1,
                    maxZoomLevel:         3,
                    visibilityRatio:         0.3,
                    tileSources:   [{
                                    Image: {
                                            xmlns:    'http://schemas.microsoft.com/deepzoom/2008',
                                            Url:      "http://***.net/Content/img/GeneratedImagesnewGrid555/last5_files/",
                                            Format:   'png',
                                            Overlap:  "0", 
                                            TileSize: "256",
                                            ServerFormat: "Default",
                                    Size: { 
                                        Width: "5816",
                                        Height: "3961"
                                    }
                                           },

                                  },
                             ]
                });

我在这里做错什么了吗?我找不到为什么我的输出缺少文件。

请帮忙,谢谢

C#:dzi图像创建opensedragon

此问题已修复,请参阅以下注释:https://github.com/openseadragon/openseadragon/issues/205#issuecomment-23394315