Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
给定一个高度和宽度。如何调整图像大小以包含该图像的最大持有者但保持纵横比?
使用你的数学
这会有所帮助
像这样:
sx = original_width/destination_width sy = original_height/destination_height if sx*original_height > destination_height: s = sy else: s = sx new_width = original_width*s new_height = original_height*s