Skip to content

Commit

Permalink
Merge pull request #2 from pyscioffice/bug_fix
Browse files Browse the repository at this point in the history
Fix convert bug
  • Loading branch information
jan-janssen authored Jul 24, 2023
2 parents 380342e + 009d680 commit b7f526d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 31 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,9 @@ pymov2gif test.mov --resolution=800x600 --framerate=10 --output_filename=test.gi
## Installation
Both the python interface and the command line interface require `pymov2gif` to be installed via `pip`:
```
pip install git+https://github.com/pyscioffice/mov2gif.git
pip install pymov2gif
```
Alternatively, `pymov2gif` can be installed using conda-forge:
```
conda -c conda-forge pymov2gif
```
29 changes: 28 additions & 1 deletion pymov2gif/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
from pymov2gif import convert
import os
import subprocess


def convert(file, resolution="800x600", framerate=10, output_file=None):
"""
Convert *.mov files to *.gif format
Args:
file (str): Input movie file in *.mov format
resolution (str): Resolution of the output *.gif file - default: 800x600
framerate (int): Framerate of the output *.gif file - default: 10
output_file (str/None): Filename of the output *.gif file - optional
"""
file = os.path.abspath(os.path.expanduser(file))
if output_file is None:
output_file = os.path.splitext(os.path.basename(file))[0] + ".gif"
command_options = (
"ffmpeg -i "
+ file
+ " -s "
+ resolution
+ " -pix_fmt rgb24 -r "
+ str(framerate)
+ " -f gif - | gifsicle --optimize=3 --delay=3 > "
+ output_file
)
subprocess.check_output(command_options, shell=True, universal_newlines=True)
2 changes: 1 addition & 1 deletion pymov2gif/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Convert *.mov files to *.gif format
"""
import argparse
from pymov2gif.convert import convert
from pymov2gif import convert


def command_line_parser():
Expand Down
28 changes: 0 additions & 28 deletions pymov2gif/convert.py

This file was deleted.

0 comments on commit b7f526d

Please sign in to comment.