I am copying a layer, adding it to an image, and shrinking it using gimp_layer_scale.
pdb.gimp_layer_scale( shrunkenLayer, nwidth , nheight , False )
I can center the shrunkenLayer using
shrunkenLayer.set_offsets( (layer0.image.width - nwidth)/2 , (layer0.image.height - nheight)/2 )
This works fine.
If I try to enlarge the shrunken layer to the full image size and center the figure contained in the layer using
wdiff = layer0.image.width-shrunkenLayer.width
hdiff = layer0.image.height-shrunkenLayer.height
pdb.gimp_layer_resize(shrunkenLayer , layer0.image.width , layer0.image.height , wDiff,hDiff)
The resulting figure is full sized (as expected) but not centered. It is at the origin of the image. I have tried +/- wdiff & hdiff but no luck. I thought this function essentially created a new layer and placed the figure from the old layer in it at an offset of wDiff,hDiff from the new layers origin (which I assume is at 0,0.
Can someone help with understand what I've got wrong here.