gimp-image-crop procedure has no option for non-destructive cropping
GIMP version: 2.10.22
Note: bug reporters are expected to have verified the bug still exists either in the last stable version of GIMP or on updated development code (master branch).
Operating System: Windows 10 and Arch Linux (kernel 5.8.10)
Package: Installer from gimp.org for Windows; Archlinux official package for Arch.
Description of the bug
GIMP since 2.10.20 supported crop tool with "Delete Cropped Pixels" options, which, if unchecked, will only crop the image and not the layers, allowing "un-cropping" later if needed, even after saving the xcf, closing gimp, and reopening the xcf.
There currently seems to be no way to replicate this behavior using script-fu. AFAIK, the only procedure in script-fu,
gimp-image-crop, always crop both the image and all the layers.
Is the bug reproducible? Always
gimp -i -n -b -
- Paste in
(let* ((input-file "anyimagefilehere") (output-file "out.xcf") (image (car (gimp-file-load RUN-NONINTERACTIVE input-file input-file))) (main-layer (car (gimp-image-get-active-layer image)))) (gimp-image-crop image (/ (car (gimp-image-height image)) 2) (/ (car (gimp-image-width image)) 2) 0 0) (gimp-xcf-save 0 image main-layer output-file output-file) (gimp-image-delete image))
out.xcfin another instance of GIMP
- Observe that the main layer is now cropped to the top left quadrant of the image.
Expected result: There should be an option in
gimp-image-crop to toggle cropping of the layers along with the image, or an alternative procedure to crop image without also cropping the layers.
Actual result: There is no way in script-fu to do non-destructive cropping.