How to crop image to a specified height and width in app engine - python?
How can I crop image to a specified height and wi开发者_JAVA技巧dth? As I see this method takes the parameters between 0.0 and 1.0.
crop(image_data, left_x, top_y, right_x, bottom_y), output_encoding=images.PNG)
Divide the width you want to crop to by the width of the image; likewise for height. This will give you the percentages (values between 0 and 1) you need to pass to the Images API.
If you don't know the size of your image ahead of time, you can use the composite
function - pass your image in as the sole input image, and specify the canvas size as the desired size of the output image.
精彩评论