Giter Club home page Giter Club logo

alfred-smart-webp-compression's Introduction

logo-dark

logo-light

made with heart by Benjamin Oddou saythanks

Welcome to the Alfred Smart WebP repository: An Alfred Workflow โœจ

โœ… Prerequisites

๐ŸŽ๏ธ cwebp

Under the hood, the compression is made with cwebp (made by Google), a tool that allows to compress images into the WebP format, which is generally lighter, and broadly used to share images on the web.

โฌ‡๏ธ Installation

  1. Download the workflow
  2. Double click the .alfredworkflow file to install

๐Ÿงฐ Setup the workflow

Open the Terminal of you Mac and run the following command:

Install cwebp (using Homebrew):

brew install webp

๐Ÿง™โ€โ™‚๏ธ Invoke the workflow

You can invoke the workflow by writing webp into the Alfred search box. You can change this value by changing the ๐Ÿ•น๏ธ Trigger variable in workflow configuration panel.

๐Ÿค– Usage of the workflow

Handling presets

Create a preset

Go under the presets section and click on Add a new preset.

Add your preset by putting a value, press โŽ and input a title and a subtitle separated by a /.

Modify a preset

Go under the presets section and click on the preset you want to modify.

Select wether you want to modify the title/subtitle or the value and press โŽ. Input the new title/subtitle or value and press โŽ.

Remove a preset

Under the presets section, click on Remove a preset.

Select the preset you want to remove and press โŽ.

Start the compression

Using Workflow File Filter

Under the home menu, click on Start the compression.

Select the folder with images or directly the image you want to compress and press enter โŽ.

Note that when selecting a folder, images within subdirectories aren't selected if ๐Ÿ” Depth of the search is 1. If you want images in subdirectories, increase this value. Only images with png|jpg|jpeg|tif|tiff|webp file extensions are selected. In addition, they aren't case sensitive, meaning that the image extension can be PNG|JpG|tifF...

Here is an example where the user selected a folder and put Level 2 in ๐Ÿ” Depth of the search :

.
โ”œโ”€โ”€ selected folder # Level 1
โ”‚   โ”œโ”€โ”€ subdirectory # Level 2
โ”‚   โ”‚   โ”œโ”€โ”€ image.PnG # selected โœ…
โ”‚   โ”‚   โ”œโ”€โ”€ a nested folder # Level 3
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ one image.webp # not selected โŒ
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ a second image.tiff # not selected โŒ
โ”‚   โ”‚   โ””โ”€โ”€ file.doc # not selected โŒ
โ”‚   โ””โ”€โ”€ first-image.jpeg # selected โœ…

Alternatively, use the Alfred Buffer to select folder(s) and image(s) at the same time !! Basic commands are :

  • โŒฅโ†‘ to add a file to the buffer from Alfred's results.
  • โŒฅโ†“ to add a file and move to the next item in your list of results.
  • โŒฅโ† to remove the last item from the buffer.
  • โŒฅโ†’ to action all items in the buffer.
  • โŒฅโŒซ to remove all items from the buffer.

To know more on how to use Alfred Buffer, follow this link.

Note that Alfred Buffer is preferred compare to the {query}, meaning that if you select a folder/image (by clicking on it or by pressing enter โŽ) that is not included in the buffer, it will not be compressed.

alfred_buffer

Choose the cwebp options by selecting a preset or input it manually by pressing Manual options.

Using Alfred Universal Actions

Select the folder(s) / image(s) you want to compress within alfred using Quick Search and run Universal Actions with โ†’ or โŒฅโ†’ if you used the Alfred buffer. Select "Compress images to WebP".

universal_action

Note that the workflow is type sensitive, meaning that if you select a file that is not part of the following types, the action "Compress images to WebP" will not be available

types

If you want to know more on how to use Alfred Universal Actions, follow this link.

Logs output

Check the logs of your compression under the Data folder. The log file contains the 2 parts.

  1. In the orange box there is :
    • Date of the compression with a YYYY/MM/dd pattern.
    • Exact time of the compression with a HH:mm:ss pattern.
    • Folder(s) + image(s) path(s) selected with a tab โ‡ฅ separator.
    • Preset or manual input. Preset will be displayed as preset_name,preset_detail whereas manual input will be displayed raw.
    • The selected level of variable ๐Ÿ” Depth of the search
  2. In the green box there is the cwebp output.

Note that each compression is separated by a line.

log_detail

โš–๏ธ License

MIT License ยฉ Benjamin Oddou

alfred-smart-webp-compression's People

Contributors

benjaminoddou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.