Code Monkey home page Code Monkey logo

hexagonit-swfheader's Introduction

The hexagonit.swfheader package provides a single function --parse -- that is able to parse the metadata in a SWF (Flash animation) file. The main use case is to interrogate the dimensions of a SWF file to help in embedding the file in a HTML page.

Usage

Using the parser is very simple, simply call the hexagonit.swfheader.parse function and call it with either a filesystem path or a file-like object.

>>> import hexagonit.swfheader >>> metadata = hexagonit.swfheader.parse(TEST_SWF) >>> pprint(metadata) {'compressed': False, 'fps': 12, 'frames': 1, 'height': 400, 'size': 153, 'version': 5, 'width': 550, 'xmax': 550, 'xmin': 0, 'ymax': 400, 'ymin': 0}

The parse function returns a dictionary that contains the following items:

version (int)

The version of the Flash format, e.g. 7.

compressed (bool)

True, if the contents of the file are compressed using zlib compression, False otherwise.

size (int)

Byte size of the (uncompressed) contents of the SWF file.

xmin (int)

The lesser x-coordinate of the bounding rectangle of the contents.

xmax (int)

The greater x-coordinate of the bounding rectangle of the contents.

ymin (int)

The lesser y-coordinate of the bounding rectangle of the contents.

ymax (int)

The greater y-coordinate of the bounding rectangle of the contents.

width (int)

The width of the SWF file in pixels.

height (int)

The height of the SWF file in pixels.

frames (int)

The number of frames in the SWF file.

fps (int)

Frames per second.

Command line

When installed with setuptools a script named swfheader is placed in your bin directory which can be used to easily introspect SWF files on the filesystem:

$ swfheader some_file.swf
SWF header
----------
Version:      7
Compression:  False
Dimensions:   1105 x 1629
Bounding box: (0, 1105, 0, 1629)
Frames:       64
FPS:          1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.