Special crop and resize
Special crop and resize
I wrote down what I need to accomplish and scanned it in:
So I would provide width of the square (25) and the command would take care of the rest.
It would be cool if I could do the whole thing in one command. Is that possible?
So I would provide width of the square (25) and the command would take care of the rest.
It would be cool if I could do the whole thing in one command. Is that possible?
Re: Special crop and resize
How are you going to know what the shortest side is ?
Code: Select all
convert input.jpg -gravity center -crop 25x25+0+0 output.jpg
Re: Special crop and resize
I was hoping the command would figure it out.Bonzo wrote:How are you going to know what the shortest side is ?
This is cropping which is cool, but I need the image to be resized also so that the shortest side is 25 pixels,Bonzo wrote:Code: Select all
convert input.jpg -gravity center -crop 25x25+0+0 output.jpg
Re: Special crop and resize
What does this give you?
See http://www.imagemagick.org/script/comma ... p#geometry
Code: Select all
convert output.jpg -resize 25x25^ -gravity center -crop 25x25+0+0 result.jpg
Re: Special crop and resize
Bonzo wrote:What does this give you?See http://www.imagemagick.org/script/comma ... p#geometryCode: Select all
convert output.jpg -resize 25x25^ -gravity center -crop 25x25+0+0 result.jpg
Code: Select all
convert: invalid argument for option `25x25^': -resize.
Re: Special crop and resize
How are you running the code - command line, php etc.
Re: Special crop and resize
Linux command line, yes.Bonzo wrote:How are you running the code - command line, php etc.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Special crop and resize
convert input.jpg -resize '25x25^' -gravity center -crop 25x25+0+0 +repage result.jpg
but need IM v6.3.8-3 or higher
but need IM v6.3.8-3 or higher
Re: Special crop and resize
fmw42 wrote:convert input.jpg -resize '25x25^' -gravity center -crop 25x25+0+0 +repage result.jpg
but need IM v6.3.8-3 or higher
Code: Select all
mattserver ~: convert --version
Version: ImageMagick 6.3.7 02/19/08 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2008 ImageMagick Studio LLC
mattserver ~: convert image.jpg -resize '25x25^' -gravity center -crop 25x25+0+0 +repage result.jpg
convert: invalid argument for option `25x25^': -resize.
mattserver ~:
Am I SOL?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Special crop and resize
Not completely out of luck. You can script it easy enough. I already have one called squareup at http://www.fmwconcepts.com/imagemagick/index.html.Damn -- one point off! I wish there were some way to upgrade IM on my client's production server. But alas, there is not.
Am I SOL?
I wrote the script before the ^ notation was available for -resize.
Re: Special crop and resize
That looks great! Thank you.fmw42 wrote:Not completely out of luck. You can script it easy enough. I already have one called squareup at http://www.fmwconcepts.com/imagemagick/index.html.Damn -- one point off! I wish there were some way to upgrade IM on my client's production server. But alas, there is not.
Am I SOL?
I wrote the script before the ^ notation was available for -resize.
Re: Special crop and resize
Hey I just tried it and it works exactly right. Thanks again!fmw42 wrote:Not completely out of luck. You can script it easy enough. I already have one called squareup at http://www.fmwconcepts.com/imagemagick/index.html.