En changeant la taille, le recadrage n'est pas toujours carré, mais il y a souvent 1 à 3 pixels de plus d'un côté.
Voici un script pour retailler l'image en carré, à lancer après recadrage :
Code : Tout sélectionner
from PSPApp import *
import PSPUtils
def ScriptProperties():
return {
'Author': u'F.Schneider',
'Copyright': u'\u00A9 2020 by F.Schneider',
'Description': u'',
'Host': u'PaintShop Pro',
'Host Version': u'22.00'
}
def Do(Environment):
# EnableOptimizedScriptUndo
App.Do( Environment, 'EnableOptimizedScriptUndo', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1)
}
})
if PSPUtils.RequireADoc( Environment ) == False:
return
Width = App.ActiveDocument.Width
Height = App.ActiveDocument.Height
if Width != Height:
if Width < Height:
Height = Width
else:
Width = Height
# ResizeCanvas
App.Do( Environment, 'ResizeCanvas', {
'AspectRatio': 1,
'FillColor': (0,0,0),
'HoriPlace': App.Constants.HorizontalType.Left,
'MaintainAspect': False,
'NewDimUnits': App.Constants.UnitsOfMeasure.Pixels,
'NewHeight': Height,
'NewWidth': Width,
'PlaceBottom': 0,
'PlaceLeft': 0,
'PlaceRight': 0,
'PlaceTop': 0,
'VertPlace': App.Constants.VerticalType.Top,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1)
}
})