Django,sorl-thumbnail裁剪图片头 [英] Django, sorl-thumbnail crop picture head

查看:275
本文介绍了Django,sorl-thumbnail裁剪图片头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如果sorl-thumbnail有从下到上的选择...我有一个垃圾问题,在一些图片中,缩略图是在图片中的人物的头上。



谢谢

解决方案

我刚刚发布了一个新版本由btol45的答案灵感来自边缘智能裁剪的sorl-thumbnail(3.2.5)。



引用文档:


默认情况下,图像在裁剪前居中。要从
边缘裁剪,请传递一个逗号分隔的字符串,其中包含 x y
百分比偏移量(负值从右侧/底部)。一些
的例子如下:




  • crop =0,0将从左边和上边缘裁剪。


  • crop = - 10,-0将从正确的边缘(10%的偏移量)和
    的边缘裁剪。


  • crop = ,0将保持x轴的默认行为(水平
    以图像为中心),并从上边缘裁剪。




图像也可以通过使用 crop =smart进行智能裁剪。图像
通过从最小熵的边删除切片
,逐渐裁剪到所请求的大小。



guys, i would like to know if sorl-thumbnail have any option to crop from the bottom to the top... i have a litter problem, in some picture sorl-thumbnail is croping the head of the people in pictures.

Thanks

解决方案

I've just released a new version of sorl-thumbnail (3.2.5) with cropping from edge and smart cropping inspired by btol45's answer.

Quoting the docs:

By default, the image is centered before being cropped. To crop from the edges, pass a comma separated string containing the x and y percentage offsets (negative values go from the right/bottom). Some examples follow:

  • crop="0,0" will crop from the left and top edges.

  • crop="-10,-0" will crop from the right edge (with a 10% offset) and the bottom edge.

  • crop=",0" will keep the default behavior for the x axis (horizontally centering the image) and crop from the top edge.

The image can also be "smart cropped" by using crop="smart". The image is incrementally cropped down to the requested size by removing slices from edges with the least entropy.

这篇关于Django,sorl-thumbnail裁剪图片头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆