I need to batch resize a number of images with a variety of aspect ratios and orientations to fit on a 800x600 (landscape) digital picture frame. Here is the relevant part of the code:
Code: Select all
Landscape = App.ActiveDocument.Width > App.ActiveDocument.Height
if Landscape:
# Resize
App.Do( Environment, 'Resize', {
'CurrentDimensionUnits': App.Constants.UnitsOfMeasure.Pixels,
'CurrentResolutionUnits': App.Constants.ResolutionUnits.PixelsPerCM,
'MaintainAspectRatio': True,
'Resample': True,
'ResampleType': App.Constants.ResampleType.SmartSize,
'ResizeAllLayers': True,
'Resolution': 72,
'Width': 800,
'SharpnessValue': 50,
'AdvancedMode': True,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((12,5,0),1)
}
})
else:
# Resize
App.Do( Environment, 'Resize', {
'CurrentDimensionUnits': App.Constants.UnitsOfMeasure.Pixels,
'CurrentResolutionUnits': App.Constants.ResolutionUnits.PixelsPerCM,
'Height': 600,
'MaintainAspectRatio': True,
'Resample': True,
'ResampleType': App.Constants.ResampleType.SmartSize,
'ResizeAllLayers': True,
'Resolution': 72,
'SharpnessValue': 50,
'AdvancedMode': True,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((12,5,0),1)
}
})
As an aside, is there an up to date document that defines the parameters for each function?
