Skip to main content

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

Change history

1.2 (2012-07-18)

1.1 (2010-05-08)

  • Fixed a bug with parsing the “fps” and “frames” fields. The order of the fields were reversed and additionally the “fps” field was parsed incorrectly. Bug reported by Valeriy Zmiyevskoy. [dokai]

1.0.1 (2008-04-29)

  • Refacted a reversed() call to make the package Python 2.3 compatible.

1.0 (2008-04-16)

  • First public release [dokai]

Download

Release files for hexagonit.swfheader 1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hexagonit.swfheader 1.2
File Size Uploaded
hexagonit.swfheader-1.2.tar.gz 5.0 kB Details

Release files / hexagonit.swfheader-1.2.tar.gz

Download URL hexagonit.swfheader-1.2.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ab095d44ac5dbc7ac54654423d42cdc9aff3515d07eb0da4faaf907cbcffefb6
BLAKE2b-256 checksum
How to use checksums
5bcbc29aee75a9c6464140db2288140e0aff8bbaab23a6cece3831235765254d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.2 This release

1 release file

1.1

1 release file

1.0.1

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page