[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: resize pictures received by mailserver



On Wed, Jun 13, 2012 at 11:17 PM, Rob Owens <rowens@ptd.net> wrote:
> On Wed, Jun 13, 2012 at 12:45:13PM +0200, Randall wrote:
>>
>> is it possible to have all messages received by the mailinglists MTA
>> scanned for pictures and have these automatically scaled to a
>> default size before its being redistributed to the receivers on the
>> mailinglist and subsequently the forum.
>>
> craigslist.org seems to do this when you upload pictures of the item
> you're selling.  I'm not sure how they do it, but I imagine they use the
> mogrify command from imagemagick:
>
> mogrify -resize 800x600 somefile.jpg
>
> This will overwrite the original somefile.jpg with an 800x600 version of
> somefile.jpg
>
> This gets tricky, because what if the original is taller than it is
> wide?  The above command will distort the image.
>

No it won't.  See the table at
http://www.imagemagick.org/script/command-line-processing.php#geometry:

widthxheight 	Maximum values of height and width given, aspect ratio preserved.

You have to suffix the geometry with a "!" if you want to actually
ignore aspect ratio.

> You can also:
>
> mogrify -resize 30% somefile.jpg
>
> This gives you the correct aspect ratio every time, but what if the
> original image was already small?
>
> Anyway, some food for thought.
>

-- 
regards,
kushal


Reply to: