-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
cx-Freeze==4.3.4 | ||
Pillow==3.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")] | ||
) |