0.0.14 ā€¢ Published 5 years ago

batch-c v0.0.14

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

batch-c

Problem:

  • You have a folder with images in them, there is nesting and mixed file types and you want to quickly convert all of the images to a different file format (probably WebP šŸ˜‰) . Take the following file structure for example:
images/
ā”œā”€ā”€ SomeText.txt
ā”œā”€ā”€ Trees.jpg
ā”œā”€ā”€ foo
ā”‚   ā”œā”€ā”€ SomeScript.js 
ā”‚   ā”œā”€ā”€ Chair.jpg
ā”‚Ā Ā  ā””ā”€ā”€ Chair Copy.jpg
ā””ā”€ā”€ bar
    ā”œā”€ā”€ Leaves.jpg
    ā””ā”€ā”€ baz
        ā””ā”€ā”€ Things.jpg

Solution:

    batch-c images --to webp
  • Batch-c converts multiple images inside a directory, all while preserving file structure (including non image files)

  • If we run the command above on the images directory from the previous example, we get this:

images-converted/
ā”œā”€ā”€ SomeText.txt
ā”œā”€ā”€ Trees.webp
ā”œā”€ā”€ foo
ā”‚   ā”œā”€ā”€ SomeScript.js 
ā”‚Ā Ā  ā”œā”€ā”€ Chair.webp
ā”‚Ā Ā  ā””ā”€ā”€ Chair Copy.webp
ā””ā”€ā”€ bar
    ā”œā”€ā”€ Leaves.webp
    ā””ā”€ā”€ baz
        ā””ā”€ā”€ Things.webp
  • Our file structure is preserved and all the images have been converted šŸ‘

Installation

    npm install --global batch-c || npm i -G batch-c

Usage

    batch-c [DIRECTORY] --to [FILE_TYPE] 
ArgumentRequiredDefaultDescriptionType
--to or -ttruenoneOutput file type.String: one of png, jpg, jpeg, webp
--out or -ofalse[ORIGINAL_DIR_NAME]-convertedOutput directory name.String: any
--dangerous or -dfalsefalsePassing this argument enables dangerous mode, batch-c will overwrite and replace images with the converted ones.Boolean: true or false