Jump to content

Image Converting


Recommended Posts

Hi,

 

I just updated my workflow for compressing images and converting image types. I also noticed that I had not mentioned it in these forums. You can download it at my Git Hub account: https://github.com/raguay/MyAlfred

 

'ci' is used to convert images to a smaller size and flatten them (remove alpha). The 'Convert Image Directory' directory action will also perform the same action on a directory of images. You currently have to change the script to get a different scale size.

 

'jpg-png' will convert from jpg format into png format.

 

'png-jpg' will convert from png format into jpg format.

 

This workflow is heavy due to having the complete ImageMagick library. If you already have that library, you can change the scripts to use it and delete the library from the workflow.

 

There is a lot of possibilities for this workflow. If you have a particular need, let me know and I will add or adopt to it. This workflow is AlleyOOP compliant.

Link to comment

Okay, which function were you using? If the 'ci' command or the 'Convert Image Directory' command? If these commands, did you set the extension first? What was the type of image you started with?

 

Currently, the 'ci' and the 'Convert Image Directory' commands will scale it down to 930x? where the height will depend on the original image. You have to change the script manually to get a different resulting size. These commands I use for a specific project, so are not generic at all. But, I do plan on expanding it if people are interested.

Link to comment

I just pushed a fix for spaces being in the name. I always work with files without spaces, so I did not test that condition at all. If you still have a problem, see if your path to the file has a directory with spaces or not. Maybe that is the issue. Also, what type of file is it originally? Not sure if ImageMagick library handles all file type. I have only tested with png and jpg.

Link to comment

I put the test-image file in "Downloads", so there are no spaces in the path. Now, the updated workflow does output an image, but it's not resized. This is the image I used. Also jpg to png does still not work.

Edited by 69wpm
Link to comment

I just pushed another fix. It now works on my system with your test file, but it takes at least 5 minutes! That is a big picture. Sorry, I did not look at the two converter routines since you did not mention them, but they had the spaces in name problem. The "png-jpg" and "jpg-png" commands now work fine on your test image. Give this new version, 1.4, a try and see. Thanks for your feedback. You should be able to update it by Alley-OOP.

Link to comment

Hi,

 

I just updated my workflow for compressing images and converting image types. I also noticed that I had not mentioned it in these forums. You can download it at my Git Hub account: https://github.com/raguay/MyAlfred

 

'ci' is used to convert images to a smaller size and flatten them (remove alpha). The 'Convert Image Directory' directory action will also perform the same action on a directory of images. You currently have to change the script to get a different scale size.

 

'jpg-png' will convert from jpg format into png format.

 

'png-jpg' will convert from png format into jpg format.

 

This workflow is heavy due to having the complete ImageMagick library. If you already have that library, you can change the scripts to use it and delete the library from the workflow.

 

There is a lot of possibilities for this workflow. If you have a particular need, let me know and I will add or adopt to it. This workflow is AlleyOOP compliant.

 

Have you considered using the 'sips' command line tool bundled with OS X? It can:

  • Convert jpeg, tiff, png, gif, jp2, pict, bmp, qtif, psd, sgi, and tga to/from each other
  • Constrain size (reduce width and/or height while maintaining aspect ratio)
  • Flip
  • Rotate
  • Crop
  • Pad (with or without a specified color)

Since the workflow does not really need all the power of ImageMagick, it might be better to use a tool included with OS X. It would reduce the weight tremendously. ;)

 

Cheers :)

Link to comment

Have you considered using the 'sips' command line tool bundled with OS X? It can:

  • Convert jpeg, tiff, png, gif, jp2, pict, bmp, qtif, psd, sgi, and tga to/from each other
  • Constrain size (reduce width and/or height while maintaining aspect ratio)
  • Flip
  • Rotate
  • Crop
  • Pad (with or without a specified color)

Since the workflow does not really need all the power of ImageMagick, it might be better to use a tool included with OS X. It would reduce the weight tremendously. ;)

 

Cheers :)

 

 

Well, I never heard of sips. It does look like a nice tool, but I can not find anything in the documentation on removing alpha channels or changing the image to a small palette of colors. I originally made it with ImageMagick because I am used to using that tool (I come from Windows/Linux. I have only had a Mac for 8 months.). I wrote this workflow to cover the need (take an image, remove alpha channel, compress the color space to 512 colors, and resize to a 930 px width.) I had and decided to share it. But, people had problems installing ImageMagick, so I included it inside it. Now, I can't seem to get GitHub to serve it properly.

 

I will post the CompressImage workflow from my own website. I will post a link here for anyone that wants it when I get it up and tested there. Sorry for the problems.

Link to comment
  • 5 months later...
  • 1 month later...
  • 5 years later...

 

On 12/9/2013 at 8:06 PM, Tyler Eich said:

 

Unfortunately, this tool is for Windows, not OS X

I have been stumped for two days, saying this isn't working.  Didn't know about alfred being on Windows.  Maybe they should have some type of marking on the working workflows.  So we know if we can do it on which platform.  Less Confusing.

Link to comment
  • 2 years later...

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