【发布时间】:2020-01-09 10:56:41
【问题描述】:
不久前我发现了一些 C# 代码,它帮助我从 XCF 文件中获取各个层的详细信息。我目前可以提取图层“x”、“y”、“图层名称”以及“图层 x”和“图层 y”的详细信息。现在我想要图层颜色、内容和旋转值(如果旋转)以及可能的任何其他细节。有人可以帮忙吗?
我的代码:
private void Form1_Load(object sender, EventArgs e)
{
string inputPdf = image_path + "offical_tour.xcf"; // GIMP file to load
string outputPng = image_path + "output.png"; // output filename
using (MagickImageCollection images = new MagickImageCollection(inputPdf))
{
int i = 0;
foreach (var image in images)
{
if (i > 0)
{
string layerFile = Path.Combine(image_path, image.Label + $".png");
image.Write(layerFile); // save the individual layers
// show some layer attributes
Console.WriteLine(image.Page.X + " x " + image.Page.Y + " = Layer:'" + image.Label + "' -- " + image.Width + " -- " + image.Height);
}
if (i++ == 0 || image.Compose != CompositeOperator.Over) continue;
}
}
}
【问题讨论】:
-
没有像AFAIK层的“旋转”这样的东西(除了可能是前文本层)。 “颜色”是 UI 中的标签颜色吗?
-
困惑 - 我有一个图层(c# 被视为“标签”),它在 GIMP 中可以旋转,具有颜色和字体类型等。我不敢相信无法提取这些细节,并且在保存到单独的文件之前更新它们??
标签: c# file attributes gimp