Metadata-Version: 2.4
Name: vsfpng
Version: 1.1
Summary: fpng for VapourSynth
License-Expression: LGPL-2.1-or-later
License-File: LICENSE
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Plugins
Classifier: Natural Language :: English
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Operating System :: Unix
Classifier: Programming Language :: C++
Classifier: Topic :: Multimedia :: Video
Project-URL: Repository, https://github.com/Mikewando/vsfpng.git
Project-URL: Issues, https://github.com/Mikewando/vsfpng/issues
Requires-Python: >=3.12
Requires-Dist: VapourSynth
Description-Content-Type: text/markdown

# fpng for VapourSynth

This is a small plugin which allows [fpng](https://github.com/richgel999/fpng) to be used with [VapourSynth](https://github.com/vapoursynth/vapoursynth).

The motivation for this plugin was to dump frames of a VapourSynth script to PNGs faster than was possible with [imwri](https://github.com/vapoursynth/vs-imwri).

## Usage

### Plugin Documentation

Usage is similar to `imwri.Write()` with ImageMagick options replaced with fpng options.

```rst
.. function:: Write(clip clip, string filename[, int firstnum=0, int compression=1, bint overwrite=False, clip alpha])
   :module: fpng

   Write will write each frame to disk as it's requested. If a frame is never requested it's also never written to disk.

   Parameters:
      clip
         Input clip. Only RGB24 is supported.

      filename
         The filename string must have one or more frame number substitutions. The syntax is printf style. For example "image%06d.png" or "/images/%d.png" is common usage.

      firstnum
         The first image number in the sequence to write.

      compression
         Matches fpng flags which are:
         0 - fast compression
         1 - slow compression (smaller output file)
         2 - uncompressed

      overwrite
         Overwrite already existing files. This option also disables the requirement that output filenames contain a number.

      alpha
         A grayscale clip containing the alpha channel for the image to write. Apart from being grayscale, its properties must be identical to the main *clip*.
```

### Example Python Script

The `examples/dump_frames.py` script included in this repository is not necessary to use the plugin, but may be useful either to directly dump frames or as a reference for the plugin usage.

```help
usage: dump_frames.py [-h] -o OUTPUT [--filename FILENAME] [--overwrite] script

Dump frames from VapourSynth script. Script will be converted to RGB24 using frame properties if they're available.

positional arguments:
  script                The VapourSynth script to fetch frames from

optional arguments:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        The output directory for dumped images (default: None)
  --filename FILENAME   The filename template for dumped images (output is always .png) (default: frame_%d)
  --overwrite           Set to overwrite existing files (default: False)
```

## Bundled Dependencies

Some dependencies are directly copied into the `src/` directory from their respective projects. It is the author's understanding that this usage is compatible with the applicable licenses.

From [fpng](https://github.com/richgel999/fpng/tree/6926f5a0a78f22d42b074a0ab8032e07736babd4) fetched 2022-04-30
 - `fpng.h`
 - `fpng.cpp`

From [libp2p](https://github.com/sekrit-twc/libp2p/tree/ed0a37adf0fdab2af95845fc80e31a6b59debebe) fetched 2022-04-30
 - `p2p.h`
 - `p2p_api.h`
 - `p2p_api.cpp`
 - `v210.cpp`

From [vs-imwri](https://github.com/vapoursynth/vs-imwri/tree/3042a327739e44b929f5ab02ff1da4d8de5ee061) fetched 2022-04-30
 - `vsutf16.h`
 - Several methods within `plugin.cpp` also directly come from `imwri.cpp`

[vapoursynth](https://github.com/vapoursynth/vapoursynth) as a submodule for
- `VapourSynth4.h`