Node gm-调整图像大小并保留宽高比? [英] Node gm - resize image and preserve aspect ratio?
本文介绍了Node gm-调整图像大小并保留宽高比?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Node gm是否内置支持在调整图像大小的同时保留宽高比(即生成缩略图)?还是应该获取图像尺寸,计算适当的比例,然后调用调整大小?
Does Node gm have built-in support for resizing an image while preserving aspect ratio (ie., generating a thumbnail)? Or should I get the image size, calculate the proper ratio, and then call resize?
此问题的灵感来自推荐答案
乔纳森(Jonathan)的评论就是解决方案: Jonathan's comment is the solution: 这会将图像的大小调整为宽度 This resizes the image to width 这篇关于Node gm-调整图像大小并保留宽高比?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!gm().resize(maxSize)
maxSize
.请参阅相关文档.maxSize
. See the relevant documentation.
查看全文