Jump to content

Smart WebP Compression


BenjaminO

Recommended Posts

Instead of asking users to edit the keyword, make it editable: Add a new Keyword configuration and set it in the workflow as {var:whatever_name} (this is explained in the linked page).


Why isn’t the presets and logs folder also defaulting to the workflow’s data folder, like the documentation folder?


Setting an images folder in the configuration seems more cumbersome than it needs be. It’s fine to have it as an option, but a File Action Trigger should be available too. A File Filter Input could connect to the same place too. Tangentially, for it to not be optional (but it should be) you should set it as required in the configuration’s backend instead of (or in addition to) mentioning it in the documentation.


The submission is also missing a listing of the required dependencies. Plus, in the workflow you’re installing extra software on the user’s behalf, which should not happen. Alfred itself can install Homebrew and dependencies from there. Seems like you’re installing perl modules too?

Link to comment
Share on other sites

Hello @vitor,

 

Thank you for your feedback ! Regarding the first two points, you're right, I'll put a configuration for the trigger and merge the two folder, it will be less confusing. in addition, I'll remove the possibility to install extra dependency within the workflow. To be honest I didn't know that Alfred could install brew and perl packages by itself.

The list of dependencies is shown in the workflow and in the documentation:

Homebrew -> to install webp, jq and cpanm
webp -> to compress images
jq -> to manipulate json data
cpanm -> to install mojo
mojolicious -> perl dependency to scrape cwebp documentation

 

However, I don't understand your third point. For me it is easier to target a folder using file filter (in the workflow) and save it as a "config variable". I remarked that env variable  aren't working when I was using the configuration. This value is intentionally optional because the workflow can't be triggered if a value is not set up (when required) which is not what I want as it is more practical to configure it within the workflow ! Same for the preset.

 

Lastly, could you explain this :

13 hours ago, vitor said:

The submission is also missing a listing of the required dependencies

 

Many thanks in advance !

Link to comment
Share on other sites

4 hours ago, BenjaminO said:

To be honest I didn't know that Alfred could install brew and perl packages by itself.


Not the Perl packages, it is extremely rare to see a Workflow needing that.

 

Why require a web framework anyway? If it’s for the documentation, it’s definitely too much. It’s OK to include docs, but they shouldn’t require the user to install extra software. At that point, it’s best to send them to a web page.

 

4 hours ago, BenjaminO said:

For me it is easier to target a folder using file filter (in the workflow) and save it as a "config variable".


That requires two steps every time you want to compress, one to set the folder and another to compress. There should at least be the option to select and compress in one go, which the File Filter and File Action can do.

 

4 hours ago, BenjaminO said:

I remarked that env variable  aren't working when I was using the configuration.


I don’t understand this part.

 

4 hours ago, BenjaminO said:

Lastly, could you explain this


You’ve done that in your post, it’s the list of software to install.

Link to comment
Share on other sites

Ok I understand. The offline doc is only there to help new user to copy paste options into their presets. I'll remove the perl script (so no more perl dependency needed) and I'll make the offline doc exportable (txt file in the workflow folder).

 

I am adding a new way to compress images to be more intuitive and straightforward even though I like reviewing my parameters before running the cwebp script

 

2 hours ago, vitor said:

I don’t understand this part.

I remarked that when setting User Configuration (text fields, text area...), env variables were not working. I don't know why. That is the reason I put Images folder into User Configuration.

 

EDIT : Do you know what's the short way to access the path of the workflow folder. I only see this way :

{const:alfred_preferences}/workflows/{const:alfred_workflow_uid}/

which is not super practical.

Edited by BenjaminO
Link to comment
Share on other sites

Hello @vitor, I just updated the workflow with a 2.0 version! 

 

Here are the changes made:

On 12/29/2022 at 8:23 PM, vitor said:

Instead of asking users to edit the keyword, make it editable: Add a new Keyword configuration and set it in the workflow as {var:whatever_name} (this is explained in the linked page).

 

screen1.thumb.png.994b53ad4a714ef4c0de629a4fe7fa7c.png

screen2.thumb.png.27fffec7ad5b9e8a9ba8f99133996dbe.png

 

On 12/29/2022 at 8:23 PM, vitor said:

Why isn’t the presets and logs folder also defaulting to the workflow’s data folder, like the documentation folder?

Presets and logs folder are now located in the the workflow’s data folder by default and can be change in the User Configuration panel. The doc is in the workflow folder (exported).

 

On 12/29/2022 at 8:23 PM, vitor said:

Setting an images folder in the configuration seems more cumbersome than it needs be. It’s fine to have it as an option, but a File Action Trigger should be available too. A File Filter Input could connect to the same place too. Tangentially, for it to not be optional (but it should be) you should set it as required in the configuration’s backend instead of (or in addition to) mentioning it in the documentation.

No more images folder or preset to select before the compression. Now we can use Universal actions (or regular search files) to select both folders and images at the same time using the buffer to compress everything. There is also the possibility to input manual options instead of presets.

 

On 12/29/2022 at 8:23 PM, vitor said:

The submission is also missing a listing of the required dependencies. Plus, in the workflow you’re installing extra software on the user’s behalf, which should not happen. Alfred itself can install Homebrew and dependencies from there. Seems like you’re installing perl modules too?

The workflow is no more installing anything. I removed perl dependencies. Only Homebrew, webp (cwebp) and jq are needed.

Link to comment
Share on other sites

  • 2 months later...
  • 3 weeks later...

Was aiming to get this in this week and it’s live: https://alfred.app/workflows/benjaminoddou/smart-webp/


A couple of suggestions:

  • When managing presets it might be nice to reopen the same window after doing an action. That would allow to, for example, delete all the default ones in a row or quickly add a bunch. Though I get that adding new presets won’t happen all the time so it’s not a big deal, just something I noticed while testing.
  • When making a preset, if we don’t add a subtitle it will show up as undefined. Might be better to just not add it or make it “No description” which at least looks intentional.
  • If a WebP image with the same name exists in the same folder, it is overwritten. It’s your choice if a naming conflict overwrites, or if it gives an error, or names the image differently. Just wanted to make sure you’re aware.
  • It wasn’t clear from the workflow alone what “Depth of the search” does. Calling it “search” might be confusing since it seems related to the File Filter part. Might be worth extending the note to make it clear it pertains to folder conversions, either in the the config itself or the About. Personally I might do without the option entirely, but it’s up to you, you probably have a reason for the choice.
  • I’m not sure it’s worth it to make the data folder configurable. I wonder if anyone will change that. Might be more useful to e.g. provide a keyword to open it fast. Unless you yourself set it to something custom, I see from your workflows that you do like having logs!

Again, none of that is a deal breaker (clearly, the workflow was added!) or even something you have to take into account. It’s basically just chatting about functionality since you seem to like stuff well organised.


Have a good weekend!

Link to comment
Share on other sites

Hey Vitor ! Thank you very much for the feedback ! To respond to your suggestions :

12 hours ago, vitor said:

When managing presets it might be nice to reopen the same window after doing an action. That would allow to, for example, delete all the default ones in a row or quickly add a bunch. Though I get that adding new presets won’t happen all the time so it’s not a big deal, just something I noticed while testing.

It has some tradeoffs so I'll let it like that for now. But maybe I can delete one example of preset to facilitate their suppression.

 

12 hours ago, vitor said:

When making a preset, if we don’t add a subtitle it will show up as undefined. Might be better to just not add it or make it “No description” which at least looks intentional.

Indeed ! This will be updated to show "No description" instead of "undefined".

 

12 hours ago, vitor said:

If a WebP image with the same name exists in the same folder, it is overwritten. It’s your choice if a naming conflict overwrites, or if it gives an error, or names the image differently. Just wanted to make sure you’re aware.

I am aware of this behavior. I didn't change it yet because I was not sure what was the best strategy to address that. I will probably add a dropdown list that will let user choose if he/she prefers to overwrites/gives error/or name images differently as you suggested. I'll need some time to do it properly. BTW, if anyone wants to contribute, don't hesitate to submit a pull request in the github repo https://github.com/BenjaminOddou/alfred-smart-webp-compression/pulls .

 

13 hours ago, vitor said:

It wasn’t clear from the workflow alone what “Depth of the search” does. Calling it “search” might be confusing since it seems related to the File Filter part. Might be worth extending the note to make it clear it pertains to folder conversions, either in the the config itself or the About. Personally I might do without the option entirely, but it’s up to you, you probably have a reason for the choice.

I am actually using it quite a lot. It allows to compress images in nested folders. I'll update the description in the user configuration panel

 

13 hours ago, vitor said:

I’m not sure it’s worth it to make the data folder configurable. I wonder if anyone will change that. Might be more useful to e.g. provide a keyword to open it fast. Unless you yourself set it to something custom, I see from your workflows that you do like having logs!

I set it up to a custom folder myself as I am checking logs manually sometimes. Indeed I like knowing what's going on and sometimes want to check details of cwebp ouput

 

Thank you again for your time and your work !

Have a nice week-end !

Link to comment
Share on other sites

1 hour ago, BenjaminO said:

I didn't change it yet because I was not sure what was the best strategy to address that. I will probably add a dropdown list that will let user choose if he/she prefers to overwrites/gives error/or name images differently as you suggested.


I feel like this is one of those situations where each user will have a specific mental model the vast majority of the time. Either “I’m super cautious and never want to risk it” or “I know what I’m doing, I only use WebP for these web projects and always keep originals safe”. A checkbox will probably be enough. For reference, that’s how Automation Tasks do it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...