Django, sorl-thumbnail crop picture head

前端 未结 4 1029
萌比男神i
萌比男神i 2020-12-30 18:40

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 hea

4条回答
  •  借酒劲吻你
    2020-12-30 19:31

    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.

提交回复
热议问题