GithubHelp home page GithubHelp logo

igormsoares / resize-images Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 106.56 MB

A bulk Image Resizer. Redimensionador de imagens em lote.

License: MIT License

Python 100.00%
bulk-image-resize cli command-line-app image image-processing image-resize image-resizer image-resizer-app image-resizing images

resize-images's Introduction

Bulk Resize Images

MIT License   MIT License   MIT License  

A command-line application to resize all images in a directory, by getting the new size input from the user. All resized images will be saved to ./imgs/resized/ by default.

I created this as a way to study python and also because I sometimes need to bulk resize large photos taken by camera.

Any suggestions and improvements will be most welcome! 😉

Overview

It maintains the aspect ratio and orientation of the original images, but it only resizes to smaller sizes, as it's intended to reduce large photo files and also to avoid quality loss by enlarging images.

The language of all the output messages can be set using the --language (or -l) flag in the command line. (Default language is en_US)

python3 resize_images.py --language pt_BR

For now, pt_BR, es_AR and en_US are already available. New languages can be added by creating a ll_LL.json file under the ./language directory. More information about that in the ./language/README.md

Dependencies

  • Pillow (PIL Fork)
pip install -r requirements.txt

# or just run:
# pip install Pillow

How to use it

  • Copy all the image files you want to resize to ./imgs/ and run resize_images.py :
# en_US is the default language:
python3 resize_images.py

# em português:
python3 resize_images.py -l pt_BR

# en castellano:
python3 resize_images.py -l es_AR
  • To choose another image directory, use the --images_dir (or -d) flag:
python3 resize_images.py --images_dir "path/to/images"
  • User will then be prompted to enter the new intended size, in pixels.

    • Examples of valid input values:
      > 1200px
      > 1200 px
      > 1200
  • Or you can specify the new size for the images by using the --size (or -s) flag:

python3 resize_images.py --size 600
python3 resize_images.py --size 600px
python3 resize_images.py --size "600 px"
  • Note that the user will only enter the size of the largest dimension, no matter whether it is width or height, as the aspect ratio is to be preserved.

  • All the images in the chosen directory will be resized to the same largest dimension size.

  • The resized images will be saved to ./imgs/resized by default. To choose another destination, use the --resized_dir (or -r) flag:

python3 resize_images.py --resized_dir "path/to/resized"
  • The file ./log.txt will be used (when necessary) to output extra informations, like:

    • Warning whether any non image file is present in the images directory.

    • Informing that a given image file was not resized due to the new size being larger than the original image dimensions.

Command-line Arguments

To see all the options run:

python3 resize_images.py -h

Default Config

To change the default value for any of the command-line arguments, edit the config.json file.

resize-images's People

Contributors

igormsoares avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

futursimple

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.