문제

A user can upload a picture to blobstore, which I would like to resize to have a maximum of only 500px in width. I don't want to specify the height since I want it to maintain the aspect ratio.

The resize() function of the images api seems to require the height as well. Is this true?

How do I get what I want?

도움이 되었습니까?

해결책

The AppEngine API docs for the resize method say:

Resizes an image, scaling down or up to the given width and height. The resize transform preserves the aspect ratio of the image. If both the width and the height arguments are provided, the transform uses the dimension that results in a smaller image.

This sounds like exactly what you want. Just specify the width, and the height will be transformed into the appropriate value to maintain the aspect ratio of the original image.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top