Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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]

# 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