我应该如何使用Python脚本调整图像的大小,以便它能够根据使用的宽度自动调整高度比?我正在使用以下代码:
def Do(Environment):
# Resize
App.Do( Environment, 'Resize', {
'AspectRatio': 1.33333,
'CurrentDimensionUnits': App.Constants.UnitsOfMeasure.Pixels,
'CurrentResolutionUnits': App.Constants.ResolutionUnits.PixelsPerIn,
'Height': 1440,
'MaintainAspectRatio': True,
'Resample': True,
'ResampleType': App.Constants.ResampleType.SmartSize,
'ResizeAllLayers': True,
'Resolution': 72,
'Width': 1920,
})
如果图像的纵横比与代码中定义的宽高比相同,即1.33333,则使用此代码非常有效。但是我该如何处理没有这个比例的图像呢?对我来说,重要的是新的宽度是1920;高度必须能够自动调整。有什么想法我的代码的哪一部分应该修改,如何修改?在
根据this forum post
–即改变
到
^{pr2}$正如我们在下面的注释中发现的,您还必须将
AspectRatio
设置为None
。在相关问题 更多 >
编程相关推荐