<div>We are going to translate this passage into Chinese according to your explanation.<br></div><div><br></div><div>Thank you</div><div><br></div><br><div class="gmail_quote">On Mon, Oct 29, 2012 at 11:22 PM, Homutov Vladimir <span dir="ltr"><<a href="mailto:vl@nginx.com" target="_blank">vl@nginx.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Mon, Oct 29, 2012 at 12:28:47PM +0400, Homutov Vladimir wrote:<br>
> On Mon, Oct 29, 2012 at 11:47:02AM +0800, chen cw wrote:<br>
> > Hi,<br>
> > we think the description for "crop" directive in<br>
> > ngx_http_image_filter_module's document is not correct, or at least not<br>
> > clear. It says "proportionally reduces an image to the size of the largest<br>
> > side". we have tested and now believes it should be not "the largest<br>
> > side", but "the smallest side".<br>
> ><br>
><br>
> Hi!<br>
><br>
> The 'largest side' is related to the arguments of the 'crop'<br>
> directive, not the source image size.<br>
><br>
> With this in mind, the description is correct.<br>
><br>
> For example,<br>
><br>
> command 'crop 600x50' for source image 640x480 will:<br>
><br>
> 1) proportionally reduce largest (600 - horizontal) side: 640->600<br>
> 2) crops extraneous edges by another side - vertical: 480->50<br>
><br>
> the result is that image got reduced horizontally a bit (proportionally)<br>
> and cropped by vertical side (50 center pixels left).<br>
><br>
> command 'crop 600x50' for 480x640 image will give 480x50:<br>
><br>
> 1) proportionally reduce horizontal side (no actions, 480 < 600<br>
> requested)<br>
> 2) leave 50 center pixels on another side<br>
><br>
> command 'crop 50x600' for 640x480 image will give 50x480:<br>
><br>
> 1) largest side is 600 (vertical), no actions (requested 600 < 480<br>
> actual)<br>
> 2) another side is cropped to 50 pixels.<br>
<br>
</div></div>actually, things are a bit more complicated:<br>
<br>
what is important, it is the correlation between width/height ratio<br>
of the source image and the desired size.<br>
<br>
The 'largest side' phrase is misleading, as ratios are<br>
compared, not sizes; thus largest ratio is important, not side.<br>
<br>
The effect is that crop chooses dimension (width or height) to be<br>
resized to reach the best fit of source image in the destination frame.<br>
<br>
if the source image has w/h ratio less than requested frame, it will be<br>
proportionally resized up to new width and extra height will be cut.<br>
<br>
if the source image has w/h ratio greater than or equal to requested frame, it<br>
will be proportionally resized to the new height and extra width will be cut.<br>
<br>
Example:<br>
<br>
# source image:640x480 (w/h = 1.333)<br>
image_filter crop 320 250; # (w/h = 1.28)<br>
<br>
since 1.33 > 1.28, source image is resized up to desired height<br>
first (333x250) and then extra width cut (320x250).<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>
<p><span lang="EN-US">--</span></p>
<p><span lang="EN-US">Charles Chen</span></p>
<p><span lang="EN-US">Software Engineer</span></p>
<p><span lang="EN-US">Server Platforms Team at Taobao.com</span><br></p><br>