From 24a07cf73ed6bb0ce99308557050d5b7b811cfc2 Mon Sep 17 00:00:00 2001 From: voidplayer Date: Fri, 8 May 2020 00:22:18 +0200 Subject: [PATCH] Option to resize layers to match the original image Its not perfect, but it works :) --- GIMP/create_spritesheet.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/GIMP/create_spritesheet.py b/GIMP/create_spritesheet.py index 8573e6a..496d76f 100644 --- a/GIMP/create_spritesheet.py +++ b/GIMP/create_spritesheet.py @@ -4,7 +4,7 @@ from gimpfu import * import math -def create_spritesheet(image, singleRow): +def create_spritesheet(image, singleRow, resizeLayers): # Grab all the layers from the original image, each one of which will become an animation frame layers = image.layers @@ -32,6 +32,10 @@ def create_spritesheet(image, singleRow): # Loop over our spritesheet grid filling each one row at a time for y in xrange(0, numRows): for x in xrange(0, numCols): + + # Make sure all layers are the same size (original image size) + if resizeLayers: + layers[layerIndex].resize_to_image_size() # Copy the layer's contents and paste it into a "floating" layer in the new image pdb.gimp_edit_copy(layers[layerIndex]) @@ -75,7 +79,8 @@ def create_spritesheet(image, singleRow): "*", [ (PF_IMAGE, 'image', 'Input image:', None), - (PF_BOOL, "singleRow", "Output to a single row?", FALSE) + (PF_BOOL, "singleRow", "Output to a single row?", FALSE), + (PF_BOOL, "resizeLayers", "Resize layers to image size?", TRUE) ], [], create_spritesheet, menu="/Filters/Animation/")