The fireworks PNG format, any insight? Any libs?

前端 未结 2 774
日久生厌
日久生厌 2021-02-10 05:17

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, applicatio
2条回答
  •  無奈伤痛
    2021-02-10 05:45

    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

提交回复
热议问题