09-22-2023, 08:32 PM
- pdb.gimp_image_resize() is the API equivalent of Image>Canvas size, but it only applies to the canvas, so the layers are not affected (as if you selected Resize layers: None).
- pdb.gimp_file_save() saves the drawable, not the image. Since the previous call did not change the layer size, the saved image has the original size.
- The easiest way to fix this is to call pdb.gimp_layer_new_from_visible() (this creates a layer which is what you see in the canvas...) and save that layer (you don't even need to explicitly add it to the image IIRC).
- A more proper way is to crop the layer before you save it.