Jump to content
raguay.customct

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.

Share this post


Link to post

This workflow doesn't work for me, it creates the "tmp" folder and that's it. I get a notification but the image is neither compressed nor converted.

Share this post


Link to post

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.

Share this post


Link to post

I used the "ci" command and set the extension to jpg first. The images are quite big, about 4000px in width so the scaling should not be a problem.

Share this post


Link to post

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.

Share this post


Link to post

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

Share this post


Link to post

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.

Share this post


Link to post

Sorry, with the full ImageMagick library, it is too big for github to download just that file. If you do a zip download of the full directory, you will get it okay. Sorry, I am fairly new to GitHub (two months).

Share this post


Link to post

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 :)

Share this post


Link to post

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.

Share this post


Link to post

HI there

Your sharing really helps me a lot.I often convert the image using another image converter before.but it can not supports to convert image to png.That's a pitty.

So i want to get some new powerful program for image converting.It would be better if it's free to use.Thanks a lot.

Share this post


Link to post

Just set the extension to "png" using "ci.ext" and all images processed with the workflow will be converted to png. It uses ImageMagic, a free image processing package that is commandline based.

Share this post


Link to post

 

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.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...