Skip to content

Instantly share code, notes, and snippets.

@BHSPitMonkey
Last active December 26, 2015 04:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BHSPitMonkey/7097279 to your computer and use it in GitHub Desktop.
Save BHSPitMonkey/7097279 to your computer and use it in GitHub Desktop.
GIMP Python Console: Batch Rotations

GIMP Python Console: Batch Rotations

Ever wanted to rotate several layers at once? Today I figured out how to randomize a handful of layer rotations using the Python Console in the GIMP.

import random
import math

# Only one image was open, so I just grabbed the first image from the list
image = gimp.image_list()[0]

# I only wanted to affect layers with "Layer" in the title, but you can use any list here
layers = [x for x in image.layers if "Layer" in x.name]

# Loop over all the layers
for layer in layers:
    ang = random.random() * 2 * math.pi
    pdb.gimp_item_transform_rotate(layer, ang, True, 0, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment