Computer Science Export-layers-to-swf_py_3.txt -...

This preview shows page 1 - 2 out of 2 pages.

#!/usr/bin/env python# Author: helour# Copyright: 2013 helour# Based on the cr33dog's script Export Layers as PNG ()# License: GPL v3+# Version: 0.2# GIMP plugin to export layers as a animated SWF file### For Windows users:## You need add SWFTools directory (which consist 'png2swf.exe' executable file) # to the GIMP environment PATH variable into the file:# C:\Program Files\GIMP 2\lib\gimp\2.0\environ\default.env# # like in example here:# PATH=${gimp_installation_dir}\bin;C:\Program Files\SWFTools#import osimport gtkfrom subprocess import check_callfrom tempfile import mkstempfrom gimpfu import *def mktmpfile(suffix):fd, filename = mkstemp(suffix=suffix)fptr = os.fdopen(fd)return filenamedef get_layers_to_export(layers, only_visible, gimp_version):result = []for layer in layers:if gimp_version >= 2.8 and pdb.gimp_item_is_group(layer):result += get_layers_to_export(layer.children, only_visible, gimp_version)else:if only_visible:if layer.visible:result.append(layer)else:result.append(layer)return result

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 2 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
john
Tags
Computer Science, Filename extension, Comparison of raster graphics editors, GIMP, SWF, SWFTools

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture