GithubHelp home page GithubHelp logo

nep-img-converter's Introduction

PILLOW Image converter

This script uses pillow to convert all images in a single folder, I'll maybe add recursive support for subfolders at somepoint but I don't need it for now.

The script is able to convert multiple souce extensions to multiple extensions, it also allow you to chose casing of the export, default is snake case.

You can also provide a list of ignores names so the script don't convert those images.

Setup

In order to use the script you must setup the LOG_BASE_DIR, which will be the folder where the script will output its logging

you can disable loging in a file by commenting / deleting the FileHandler at line 20 :

log.FileHandler(f"{log_base_dir}/converter.log")

(can also rename the output file there)

Usage

converter.py [-h] [-s [SOURCE_EXTENSIONS ...]] [-t [TARGET_EXTENSIONS ...]] [-i [IGNORE_NAMES ...]] [-c CASE] [-o] path_to_exec

You can view all possibilities and options using converter.py -h

But globally it's kinda easy to use:

python converter.py "path/to/the/folder" -s "png" "jpg" -t "webp" -o -i "mycat" -c "camel"

This will convert all .png and .jpg files in path/to/the/folder to .webp overwriting possibly existing .webp with the same name, it will export the new files in camelCase and ignore the image named "mycat" no matter its extension.

We could have used unshortcuted options as such but it's longer:

python converter.py "path/to/the/folder" --source-extensions "png" "jpg" --target-extensions "webp" --overwrite --ignore-names "mycat" --case "camel"

Logging

The script use the default logging lib from Python, it logs all levels from debug to critical, you can change the level of logging at line 16 or add new logs using log.level(message)

nep-img-converter's People

Contributors

nepmia avatar

Stargazers

 avatar

Watchers

 avatar

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.