Jump to content

ImageMagik Workflow


Recommended Posts

I wonder if anyone can help me.

 

I have been using Ramiro's workflow (the first version) for imageoptim-cli and it has worked brilliantly:

 

I simply used Alfred to find the image on my desktop and then just chose the Optimize Images action to run it.

Perfect.

 

However now I'm getting good results from ImageMagik's command line tools and would like a similar workflow.

 

This is what I run in terminal:

convert /Desktop/myimage.jpg -strip -quality 75 -interlace line /Desktop/myimage2.jpg 

How could I turn that into a similar workflow?

Many thanks 

 

 

Link to comment

Running the command on a file is entirely trivial to do.

The question is: how does the input and output work?

 

You want input via a File Action, which is super simple.

 

But what about the output files?

 

Are the original files replaced? Are the optimised files saved to the same directory as the originals with a different name, e.g. NAME.optimised.EXT? Are they saved with the same name, but to a different directory? Are the original files renamed to, say, NAME.orig.EXT, and the optimised versions saved under the original names?

 

Unless you're overwriting the originals, some manner of path/filename manipulation is going to be necessary.

Link to comment

Thanks very much deanishe

I don't mind overwriting the file if it's easier to create a workflow like that but currently when I enter the path for /myimage.jpg  into the terminal I also enter something like /myimage2.jpg into the second part of the code and that is what is output. Usually to the same directory.

 

I mean it would be great if it set up a new folder like the tinypng workflow does for optimised images but that would only be vital if there was no way to output a new filename and it was consistently a problem to overwrite the original.

 

thanks 

Link to comment
  • 2 weeks later...

Hi deanishe

The way I'd like it to work would be to use Alfred to navigate to the image (which is likely to be on my desktop - eg /Desktop/myimage.jpg as per original post) and then to be able to use the right arrow to select an action which will run the convert script.

Like this:

https://www.dropbox.com/s/vz64pgyh89vy759/Screenshot%202015-11-25%2010.58.14.png?dl=0

It would be great if it could assign a new name to the converted image in order to keep the original but not essential.

 

Many thanks

Link to comment

You need to open up the Run Script action in the workflow and configure the settings.
 
The comments in the script explain what stuff does. In particular: 

# Perform conversion with ImageMagick
convert = ['/usr/local/bin/convert']
 
# Perform conversion with GraphicsMagick
# convert = ['/usr/local/bin/gm', 'convert']
 
# Options to pass to `convert` command
convert_options = ['-strip', '-quality', '75', '-interlace', 'line']

 
For ImageMagick, you need to change the corresponding setting to point to the right place: 

convert = ['/usr/local/bin/convert']

to: 

convert = ['/the/place/you/installed/convert']

 
If you want to use GraphicsMagick, you need to uncomment the corresponding line: 

# convert = ['/usr/local/bin/gm', 'convert']

 to: 

convert = ['/usr/local/bin/gm', 'convert']

If you uncomment the GraphicsMagick setting, that will override the ImageMagick one.

Link to comment

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