Hi Fred,

That didn't seem to do much either, for portraits it just seems to be
cropping them normally as a straight forward portrait not to my 180x130
required size. :-/

Hmmmmm.

Dave

On Feb 17, 2008 2:57 AM, Fred Weinhaus <[EMAIL PROTECTED]> wrote:

> Dave,
>
> Sorry, I got started with an idea and then found a counter situation.
> Using 180x130^ is not quite right.
>
> The problem is that if you do what I said below and your image is
> square (say 200x200), then what you get is an image that is 130x130
> (I think - I have not tried it). If so, then you have no image to
> make the width 180 and would have to pad it with some background.
>
> So say, if your image is 270 (or bigger) x 200, then you would get an
> image that was 180 (or bigger) x 130, if you scaled to 130. Then you
> would have enough room to get the center 180x130.
>
> But if it is less than 270 in width, then you have too little width
> after resizing to 130 to get 180x130 without padding.
>
> To put it another way, if the aspect ratio w/h is greater than
> 180/130=1.385, this works. But if it is less, then it does not work.
>
> When the size is less than 270 x 200, or more properly the aspect
> ratio, w/h is less than 1.385, then you want to scale to the larger
> dimension, which is 180. Then you get something that is 180 x 130 (or
> bigger). So for example if you have your 200x200 and resize to 180
> for the width, then you get a height and width of 180 and can then
> get a 180x130 center area from it.
>
> So the key is to check the aspect ratio. If w/h > 180/130, then
> resize to the minimum dimension (130) and crop out the center
> 180x130; otherwise resize to the maximum dimension (180) and crop out
> the center 180x130.
>
> I think this means:
>
> if aspect=w/h > 180/130, then
>
> convert 1.jpg -filter Lanczos -resize 130x130 -gravity center 1_.jpg
>
> else
>
> convert 1.jpg -filter Lanczos -resize 180x180 -gravity center 1_.jpg
>
> (similarly if you use -thumbnail in stead of -resize)
>
> Again, I have not tested this. Perhaps tomorrow I can check it out.
>
>
> Fred
>
>
>
>
> >Hehe, that was a little confusing, sorry. So you're saying do
> >something like this:
> >
> >convert 1.jpg -filter Lanczos -resize 180x130^ -gravity center
> >1_.jpg but it wont work for square images.
> >
> >Dave
> >
>



-- 
David Di Biase
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to