views:

59

answers:

4

I have a jpeg image of 400x400 px that i want to paste into a 960x640 image. Is there a command line image processor that I can use on OSX? Thanks!

+1  A: 

You can use ImageMagick

jigfox
+1  A: 

There are command-line tools like ImageMagick, but you might find OSX's Automator to be easier to use.

David
my goal is, to use it on the iPhone afterwards.
tzippy
Use the image on the iPhone, or run the image processing program on the iPhone?
David
no, use the image processor on the iphone. i use a shell script and curl to dl an image that i need to resize and then replace LockBaground.png with this image to make it my wallpaper.
tzippy
+1  A: 

Since you're on OS X, you can look into SIPS (scriptable image processing system) since it is installed by default. I'm not sure I fully understand what you're doing, but from your comments it looks like you're just trying to resize the image. If that's the case, have a look at the --resampleHeightWidth, --padToHeightWidth, and --cropToHeightWidth options on the man page linked above.

For example, you might try sips -z 960 640 yourinputimage.jpeg

EDIT: Based on your comment -- no, you cannot do this with SIPS to my knowledge. As others have mentioned, your best bet is probably ImageMagick. Once installed, you can use the composite command-line tool to do what you're asking. See this documentation.

Segphault
Thank you! No, not really resize. I want to "paste" the 400x400 image on y 960x640 canvas. I want to keep the proportions of the original image. is that possible?
tzippy
@tzippy: Ah, I understand. You can't do this with SIPS -- you'll need to use ImageMagick as others have suggested. See my edited answer.
Segphault
`sips -p 960 640 filename.jpg` will center the original image in a 960x640 canvas -- is this what you need?
Gordon Davisson
Thanks Gordon! Exactly what I needed.I use --padColor to get a white canvas!sips -p 960 640 --padColor FFFFFF original.jpg
tzippy
+3  A: 

If you want it on iPhone, then I'll suggest you to search or even build Image Magick for the iPhone.

It will allow you to resize images right from the command line.

karlphillip