烟花PNG格式,有什么见解吗?有库吗?

发布于 2024-10-04 04:54:04 字数 736 浏览 4 评论 0原文

最终目标是将烟花 png 文件中的页面导出为单独的图像。所以我有几个问题:

  1. 你知道有什么东西——库、应用程序——已经可以做到这一点了吗?
  2. 你有关于格式的信息吗?我认为他们将信息存储在专门的块中。我只是希望这些块的有效负载的格式不那么难弄清楚。

我还没有挖掘过任何烟花文件。我没有找到有关格式的信息,所以这是下一步,但我认为有人可能知道一点并节省我一些时间:)。

我希望(可能并非如此)每个页面都以 PNG 形式存储在单独的 IDAT 块中。不过,由于矢量功能,这种情况不太可能发生。也许他们在块中存储 svg 格式?

任何帮助或讨论表示赞赏。我计划在接下来的几天内深入研究这个问题。

Ben

编辑:这里有几件事:下面链接的超级用户帖子表明文件是 APNG。烟花文件不是 APNG。 APNG 包含动画块:acTL、fcTL、fdAT。除了 IDAT 块之外,Fireworks 还具有 prVW、mkBF、mkTS、mkBS、mkBT 块,但没有 APNG 块。

这里有一篇关于烟花 PNG 的非常扎实的文章: http:// newsgroup.xnview.com/viewtopic.php?f=35&t=20592#p86243

所以我想我需要知道这些块的作用以及如何解析它们。

The ultimate goal is to export the pages in a fireworks png file to individual images. So I have a couple questions:

  1. Do you know of anything -- library, application -- that does this already?
  2. Do you have any information on the format? They store their information in specialized chunks, I assume. I'm just hoping the format of those chunks' payload is not so difficult to figure out.

I have not dug into any fireworks files yet. I am finding no information on the format, so that is next step, but I figured someone may know a bit and save me some time :).

What I hope (and probably isnt the case) is that each page is stored as PNG in separate IDAT chunks. Unlikely, though, due to the vector capabilities. Maybe they store svg format in the chunks?

Any help or discussion is appreciated. I plan to dig into this in the next couple days.

Ben

EDIT: Here are a couple things: the linked superuser post below indicates the files are APNG. fireworks files are not APNG. APNG contains animation chunks: acTL, fcTL, fdAT. Fireworks has, in addition to the IDAT chunks, prVW, mkBF, mkTS, mkBS, mkBT chunks but none of the APNG chunks.

There is a pretty solid post here on fireworks PNGs: http://newsgroup.xnview.com/viewtopic.php?f=35&t=20592#p86243

So I suppose I need to know what these chunks do, and how to parse them.

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

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

发布评论

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

评论(2

抠脚大汉 2024-10-11 04:54:04

我自己对 Adob​​e Fireworks 文件中的私有块类型进行的一些挖掘如下(假设 Python 切片表示法):

prVW(“缩略图预览?”)

Data format:
- bytes[0:4]   - Chunk length
- bytes[4:8]   - Chunk type
- bytes[8:10]  - zlib file magic 0x789c
- bytes[10:-8] - zlib data
- bytes[-8:-4] - zlib checksum
- bytes[-4:]   - Chunk checksum

After decompressing, the first 4-bytes are the value "0xcafebeef",
likely another file magic byte value for whatever format the data is
in.

mkBF

Data format:
- bytes[0:4]   - Chunk length
- bytes[4:8]   - Chunk type
- bytes[8:12]  - 0xfadecafe (file magic?)
- bytes[12:16] - big-endian length value?
- bytes[16:80] - 64-byte NULL-padded data field
- bytes[80:84] - Chunk checksum

mkBS

Data format:
- bytes[0:4]   - Chunk length
- bytes[4:8]   - Chunk type
- bytes[8:10]  - zlib file magic 0x789c
- bytes[10:-8] - zlib data
- bytes[-8:-4] - zlib checksum
- bytes[-4:]   - Chunk checksum

mkBT

Data format:
- bytes[0:4]   - Chunk length
- bytes[4:8]   - Chunk type
- bytes[8:12]  - 0xfacecafe (file magic?)
- bytes[12:16] - Unknown big-endian value.  Increments for
                 each mkBT chunk present, and appears to only
                 consume the lower 24-bits.
- bytes[16:84] - 68-byte NULL-padded data field
- bytes[84:86] - zlib file magic 0x789c
- bytes[86:-8] - zlib data
- bytes[-8:-4] - zlib checksum
- bytes[-4:]   - Chunk checksum

This chunk may contain a split/spanned zlib stream, as the decompressed
data is cut at 64kb per mkBT chunk and does not appear to carry a zlib
checksum value.  Decompressing each zlib stream and then concatenating them
all together does not appear to be wrong.

mkTS

Data format:
- bytes[0:4]   - Chunk length
- bytes[4:8]   - Chunk type
- bytes[8:10]  - zlib file magic 0x789c
- bytes[10:-8] - zlib data
- bytes[-8:-4] - zlib checksum
- bytes[-4:]   - Chunk checksum

Some digging I did on my own for the private chunk types in Adobe Fireworks files is as follows (assume Python slicing notation):

prVW ("thumbnail preview?")

Data format:
- bytes[0:4]   - Chunk length
- bytes[4:8]   - Chunk type
- bytes[8:10]  - zlib file magic 0x789c
- bytes[10:-8] - zlib data
- bytes[-8:-4] - zlib checksum
- bytes[-4:]   - Chunk checksum

After decompressing, the first 4-bytes are the value "0xcafebeef",
likely another file magic byte value for whatever format the data is
in.

mkBF

Data format:
- bytes[0:4]   - Chunk length
- bytes[4:8]   - Chunk type
- bytes[8:12]  - 0xfadecafe (file magic?)
- bytes[12:16] - big-endian length value?
- bytes[16:80] - 64-byte NULL-padded data field
- bytes[80:84] - Chunk checksum

mkBS

Data format:
- bytes[0:4]   - Chunk length
- bytes[4:8]   - Chunk type
- bytes[8:10]  - zlib file magic 0x789c
- bytes[10:-8] - zlib data
- bytes[-8:-4] - zlib checksum
- bytes[-4:]   - Chunk checksum

mkBT

Data format:
- bytes[0:4]   - Chunk length
- bytes[4:8]   - Chunk type
- bytes[8:12]  - 0xfacecafe (file magic?)
- bytes[12:16] - Unknown big-endian value.  Increments for
                 each mkBT chunk present, and appears to only
                 consume the lower 24-bits.
- bytes[16:84] - 68-byte NULL-padded data field
- bytes[84:86] - zlib file magic 0x789c
- bytes[86:-8] - zlib data
- bytes[-8:-4] - zlib checksum
- bytes[-4:]   - Chunk checksum

This chunk may contain a split/spanned zlib stream, as the decompressed
data is cut at 64kb per mkBT chunk and does not appear to carry a zlib
checksum value.  Decompressing each zlib stream and then concatenating them
all together does not appear to be wrong.

mkTS

Data format:
- bytes[0:4]   - Chunk length
- bytes[4:8]   - Chunk type
- bytes[8:10]  - zlib file magic 0x789c
- bytes[10:-8] - zlib data
- bytes[-8:-4] - zlib checksum
- bytes[-4:]   - Chunk checksum
软甜啾 2024-10-11 04:54:04

有趣的问题。

如果您尝试编写一个获取 Fireworks PNG(APNG) 并保存页面的实用程序,那么它有多大帮助,但这里是:

您可以使用 Fireworks 中的“导出”菜单:文件 > >出口>页面到文件

您也可以使用另存为选项并选择Photoshop PSD
此选项将页面保留为 Photoshop 图层面板中的文件夹/组,
但它确实栅格化矢量形状。不过,如果您想解析,它可能会很方便
PSD
而不是 APNG(用于访问图像、页面)。

我编写了一个小脚本(主要使用 docs),它将当前打开的 Fireworks PNG 的 PSD 保存到您选择的文件夹中:

var doc = fw.getDocumentDOM();
var loc = fw.browseForFolderURL("select a folder to save pages");

var prevWarn = fw.getPref("PsdExport_Warn100"); // bool 
fw.setPref("PsdExport_Warn100", false);    // don't warn. 

var kObjToLayer = 1; 
var kFlatten = 2; 
var prevLayers = fw.getPref("PsdExport_Layers"); 
fw.setPref("PsdExport_Layers", kObjToLayer);    // flatten layers or not. 

var kEffectEditable = 1; 
var kEffectRender = 2; 
var prevEffects = fw.getPref("PsdExport_Effects"); 
fw.setPref("PsdExport_Effects", kEffectEditable); 

var kTextEditable = 1; 
var kTextRender = 2; 
var prevText = fw.getPref("PsdExport_Text"); 
fw.setPref("PsdExport_Text", kTextRender); 

if(loc) fw.exportPSD(doc, loc+"/yourPages.psd"); 

// Put the prefs back. 
fw.setPref("PsdExport_Warn100", prevWarn); 
fw.setPref("PsdExport_Layers", prevLayers); 
fw.setPref("PsdExport_Effects", prevEffects); 
fw.setPref("PsdExport_Text", prevText);

如果将其另存为 .jsf 文件,并在 Fireworks 中打开文档,您应该只需双击.jsf 文件。

另外,注意到有一个导出 PSD 扩展可用,它比我这里的小脚本有更多的选项。

如果您需要矢量形状,可以使用文件导出>; FXG 和图像,然后选择格式下方的所有页面。 FXG 是一种 xml 格式,并且可以使用规范

华泰

Interesting question.

Don't how much it helps, if you're trying to write an utility that gets a Fireworks PNG(APNG) and saves the pages, but here goes:

You could use the Export menu in Fireworks: File > Export > Pages to Files.

Also you could use the Save as option and choose Photoshop PSD.
This option preserves the pages as folders/groups int the Photoshop Layers Panel,
but it does rasterize vector shapes. Still, it could be handy if you want to parse
a PSD
instead of a APNG(to access images,pages).

I've put together a small script (mostly using the docs) which saves a PSD of your currently open Fireworks PNG to a folder you choose:

var doc = fw.getDocumentDOM();
var loc = fw.browseForFolderURL("select a folder to save pages");

var prevWarn = fw.getPref("PsdExport_Warn100"); // bool 
fw.setPref("PsdExport_Warn100", false);    // don't warn. 

var kObjToLayer = 1; 
var kFlatten = 2; 
var prevLayers = fw.getPref("PsdExport_Layers"); 
fw.setPref("PsdExport_Layers", kObjToLayer);    // flatten layers or not. 

var kEffectEditable = 1; 
var kEffectRender = 2; 
var prevEffects = fw.getPref("PsdExport_Effects"); 
fw.setPref("PsdExport_Effects", kEffectEditable); 

var kTextEditable = 1; 
var kTextRender = 2; 
var prevText = fw.getPref("PsdExport_Text"); 
fw.setPref("PsdExport_Text", kTextRender); 

if(loc) fw.exportPSD(doc, loc+"/yourPages.psd"); 

// Put the prefs back. 
fw.setPref("PsdExport_Warn100", prevWarn); 
fw.setPref("PsdExport_Layers", prevLayers); 
fw.setPref("PsdExport_Effects", prevEffects); 
fw.setPref("PsdExport_Text", prevText);

If you save this as a .jsf file, and have a document open in Fireworks, you should be able to just double click the .jsf file.

Also, noticed there's an Export PSD extension available, which has more options than my little script here.

If you need the vector shapes, you can use File Export > FXG and Images and choose All Pages bellow the format. FXG is an xml format, and the specs are available.

HTH

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