Skip to main content

ani file reader and writer

Project description

ani_file

.ani file (animated cursor) reader and writer written in python 3.

Was trying to batch extract the frame of some .ani file I got but noticed that there were no library to do so in python so I created one.

Starting point

Open ANI file in similar manner to builtin.open(): from ani_file import ani_file f = ani_file.open(file,mode)

file can be string or file-like object.

mode can be: "r" or "rb" to read an existing .ani file. "w" or "wb" to create a new .ani file. Will overwrite existing file if given same name

Read .ani

Available getter:

getframesinfo() (NOT IMPLEMENTED YET): dictionary of info about number of frames, display sequence of frames, display rate of frames

getnframes(): return number of frames

getseq(): return list of sequence in which the frames appear

getrate(): return list of display rate for each frame

getframesdata(): return list of binary data of each frame

getauthor(): Get name of artist/corporation if present

getname(): Get ani file name (Not the name of the .ani file) if present

Extract and save frames into .ico files:

saveframestofile(outputpath,filenameprefix): Save to specified path. Name of each file will be filenameprefix + index from 0

Write .ani

Available getter (NOT IMPLEMENTED YET):

Same as for read .ani

Available setter:

setframespath(framespath): set list of .ico files that make the frames of the final .ani file. The only function that you really need to write an .ani file

setseq(seq): set seq

setrate(rate): set rate

setauthor(iart): set name of artist

setname(inam): set name of the ani file

Example (INCOMING)

.ani file structure explain (INCOMING)

Code based on wave.py at https://github.com/python/cpython/blob/3.10/Lib/wave.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ani_file-0.0.2.tar.gz (5.9 kB view hashes)

Uploaded Source

Built Distribution

ani_file-0.0.2-py3-none-any.whl (6.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page