Code Monkey home page Code Monkey logo

flippy's Introduction

flippy

Generate flip-books from videos and animated GIFs

Prerequisites

  • Python 3 or later
  • Pillow 3.x
  • FPDF 1.7.x or later

Download code

Download flippy.py from the flippy repository, or do

git clone https://github.com/ola-ct/flippy.git

to clone the repository into a local folder.

Installation

macOS

You want to install Brew package manager first:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Then install pipenv to host a virtual environment:

brew install pipenv

Enter the project's directory and install the required modules into Pipenv's virtual environment:

cd flippy
pipenv install

You can now run flippy as shown below from inside the Pipenv shell (pipenv shell).

Linux

Install Pipenv with your distribution specific package manager.

Enter the project's directory and install the required modules into Pipenv's virtual environment:

cd flippy
pipenv install

You can now run flippy as shown below from inside the Pipenv shell (pipenv shell).

Usage

General usage

flippy.py 
  [-h] [--help]
  --input INPUT
  --output OUTPUT
  --height HEIGHT
  --paper {a2,a3,a4,a5,letter,legal}
  --offset
  --dpi DPI
  --fps FPS

INPUT: filename of video or GIF image to be converted

OUTPUT: name of file to write PDF to

HEIGHT: Height of flip-book (default: 30.0 mm)

PAPER: paper format (default: a3); only valid for PDF output

OFFSET: Margin left to each frame (default: 15.0 mm)

DPI: convert video/GIF to the given resolution in dots per inch (default: 200 dpi)

FPS: convert video/GIF to this many frames per second before PDF generation (default: 10 fps)

flippy's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

flippy's Issues

Linux installation

I suggest you add under Linux a section for Debian, or modify the existing section:

sudo apt-get install python-pip
sudo pip install Pillow fpdf moviepy

to make installation easier for the Linux users.

fps option is not working

The --fps option does not work, video is always 10 fps, or transcoded from any other input-fps to 10 fps. This does not make sense.

The fps parameter should determine the number of flip-book images in the pdf output. See also #3 Let the user select the number of output images instead of the frame rate.

errore form fpdf import FPDF

Buon Giorno, python 3.7, fpdf versione 1.7.2
dal comando from il modulo FPDF non risulta caricabile:

import os
from fpdf import FPDF
import PyPDF2

def img2pdf(folder_path, name):
pdf = FPDF('L', 'pt', 'letter')
pdf.add_page()
pdf.image(folder_path + '/' + name + '.png')
pdf.output(folder_path + '/' + name + '1.pdf', 'F')

inputFile = open(folder_path + '/' + name + '1.pdf', 'rb')
pdfReader = PyPDF2.PdfFileReader(inputFile)

output_pdf = PyPDF2.PdfFileWriter()
output_pdf.addPage(pdfReader.getPage(1))

output_pdf.encrypt(str.lower(name))
with open(folder_path + '/' + name + '.pdf', "wb") as out_file:
    output_pdf.write(out_file)

out_file.close()
inputFile.close()

os.remove(folder_path + '/' + name + '.png')
os.remove(folder_path + '/' + name + '1.pdf')

dir= r"C:\Users\v.mavilla\Desktop"
file= r"Preventivo-121_2020.pdf"
img2pdf(dir,file)

ottengo l errore:
C:\Users\AppData\Local\Programs\Python\Python37-32\python.exe "C:/MyPyton/Progetti/Libretti Jungherich/fpdf.py"
Traceback (most recent call last):
File "C:/MyPyton/Progetti/Libretti Jungherich/fpdf.py", line 2, in
from fpdf import FPDF
File "C:\MyPyton\Progetti\Libretti Jungherich\fpdf.py", line 2, in
from fpdf import FPDF
ImportError: cannot import name 'FPDF' from 'fpdf' (C:\MyPyton\Progetti\Libretti Jungherich\fpdf.py)

[Suggestions] To-Do list

Some suggestions in form of a to-do list:

  • avoid the "zero" 0 for counting, I suggest to always start with number "1" for the first "flip-book page"
  • Auto-generate a title image ("Deckblatt") with meta data like the filename and file creation date. Number should be "1", not "0" (zero).
  • Add a framework for a web-based service (upload or side-load of a video, then processing and download possibility)
  • #3 Let the user select the number of output images instead of the frame rate
  • #6 option to crop and/or to zoom the video before the flip-book is created

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.