Giter VIP home page Giter VIP logo

imagescaler's Introduction

ImageScaler

A simple CLI utility class to scale images written in Java. This utility reads images, either from the local file system or an online source, and creates a thumbnail version as well as a "full-size" version. Supported formats include JPG, PNG, GIF, BMP, WBMP.

To use the utility, it can be compiled to a JAR, and ImageScaler can be run using java -jar ImageScaler.jar

Usage

Every usage requires --thumb-out and --full-out to be defined. A source of files to process must also be defined, which can either be a newline-delimited file with --in-file or a directory containing files with -in-dir. Run ImageScaler without any arguments to view this usage.

usage: ImageScaler [options] --thumb-out --full-out --[in-file OR in-dir]
 -d,--in-dir <arg>        Directory containing images to process.  Only
                          this or in-file should be provided, not both.
 -f,--full-width <arg>    The width in pixels of the generated full image.
                          Default: 400px
 -fo,--full-out <arg>     Directory to write the full images
 -i,--in-file <arg>       File containing paths of images to process,
                          separated by newline. By default, the paths will
                          be treated as local paths. Use the --online
                          switch if the paths are to be downloaded to the
                          working directory first. Only this or in-dir
                          should be provided, not both.
 -o,--online              To be used with the --in-file switch to indicate
                          that the paths are online sources
 -r,--recursive           If using in-dir, whether to scan directories
                          recursively. Default is false.
 -t,--thumb-width <arg>   The width in pixels of the generated thumbnail.
                          Default: 150px
 -to,--thumb-out <arg>    Directory to write the thumbnails

Example: Scale All Images In a Directory

If the directory "C:\imgs" contains image files and you'd like to have thumbnails of size 128 and full-size images of size 256 in the directories "C:\imgs\thumbs" and "C:\imgs\full", execute the following.

ImageScaler -d "C:\imgs" -to "C:\imgs\thumbs" -fo "C:\imgs\full" -t 128 -f 256

Example: Scale Images By Paths

Assuming the file imgs.txt contains a list of local paths of images to scale, the images can be scaled into the defined directories.

ImageScaler -i "C:\imgs\imgs.txt" -to "C:\imgs\thumbs" -fo "C:\imgs\full"

Example: Download and Scale Images

Assuming the file imgs.txt contains a list of newline-delimited URLs of images, the images can be downloaded and scaled in 1 step.

ImageScaler -i -o "C:\imgs\imgs.txt" -to "C:\imgs\thumbs" -fo "C:\imgs\full"

Credits

ImageScaler makes use of the following libraries.

imagescaler's People

Contributors

phanigaddipati avatar

Watchers

James Cloos avatar  avatar Joshua Budman 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.