Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
yaras committed Feb 14, 2016
1 parent 9904d42 commit 616b290
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
23 changes: 23 additions & 0 deletions converter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from PIL import Image
from PIL import features
import os

def convert(inputFile, outputFile):
im = Image.open(inputFile).convert("RGB")
im.save(outputFile, "jpeg")

print('Converted {} to {}'.format(inputFile, outputFile))

def main():
for f in os.listdir('.'):
if f.upper().endswith('.WEBP'):
outputFile = f[:-5] + '.jpg'

if os.path.exists(outputFile):
print('Warning! {} not converted, because {} already exsits'.format(f, outputFile))
else:
convert(f, outputFile)

if __name__ == '__main__':
print ('WEBP:', features.check_module('webp'))
main()
20 changes: 20 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# WEBP Converter

Script for converting WEBP to JPG.

## Version

0.1.0

## Run

Start `converter` in directory containing WEBP files.

## Build from source

```sh
virtualenv env
env\Scripts\activate
pip install -r requirements.txt
python setup.py build
```
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cx-Freeze==4.3.4
Pillow==3.1.1
14 changes: 14 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from cx_Freeze import setup, Executable

includefiles = []
includes = []
excludes = []
packages = ["PIL.Image", "PIL.WebPImagePlugin"]

setup(
name = "WEBP Converter",
version = "0.1.0",
description = "This is my program",
options = {'build_exe': {'includes': includes, 'excludes': excludes, 'packages': packages, 'include_files': includefiles}},
executables = [Executable("converter.py")]
)

0 comments on commit 616b290

Please sign in to comment.