Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GIMP: Hide/Show all layers in current image
;; When editing an image with many layers (e.g. an animated GIF with
;; hundreds of frames), it's impossibly tedious to click hundreds and
;; hundreds of times on small little boxes to hide or show all layers.
;; Since GIMP seems to lack a button to hide/show all of them, and it
;; doesn't allow selection of multiple layers, this script provides
;; menu items to hide/show all layers at once.
;; Who knows if later versions of GIMP than I have provide a way to do
;; this, but this works, and maybe it will be helpful to someone.
(define (script-fu-hide-all-layers image)
(map layer-hide (image-layers image)))
(define (script-fu-show-all-layers image)
(map layer-show (image-layers image)))
(define (layer-hide layer)
(gimp-item-set-visible layer 0))
(define (layer-show layer)
(gimp-item-set-visible layer 1))
(define (image-layers image)
(vector->list (cadr (gimp-image-get-layers image))))
(script-fu-register
"script-fu-hide-all-layers"
"Hide All"
"Hides all layers"
"A tired GIMP user"
"Copyright for this silly little thing? Haha."
"January 1, 1970"
"*"
SF-IMAGE "Image" -1)
(script-fu-register
"script-fu-show-all-layers"
"Show All"
"Shows all layers"
"A tired GIMP user"
"Copyright for this silly little thing? Haha."
"January 1, 1970"
"*"
SF-IMAGE "Image" -1)
(script-fu-menu-register "script-fu-hide-all-layers" "<Image>/Image/Layer Visibility")
(script-fu-menu-register "script-fu-show-all-layers" "<Image>/Image/Layer Visibility")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment