[Android Themes] Kdio:
More one feature to the battery batch:

Pick up an image and select if it will be at foreground or background:

The new interface is like this:

With 2 different backgrounds to add to the battery icons set, we can easily create the below animation:

I've changed the Menu where the tool appear .. It has its own menu "Theming" now ... The main tool has been updated too.

Nice regards.

import os
import time
import datetime
import shutil
from gimpfu import *

pdb = gimp.pdb

#################################################
# Routine that executes the transformations
#################################################
class DoTransform:
def __init__(self):
pass
def applyMod(self, image, new_width, new_height, keep_size, sharpeness, radius, amount, threshold):
layer = image.layers[0]
drawable = layer
is_indexed = pdb.gimp_drawable_is_indexed(drawable)
is_gray = pdb.gimp_drawable_is_gray(drawable)
is_rgb = pdb.gimp_drawable_is_rgb(drawable)

##################
# Convert RGB
##################
if is_rgb == False:
pdb.gimp_image_convert_rgb(image)
##################

##################
# Scale Layer
##################
if ((new_width > 0) and (new_height > 0)):
pdb.gimp_layer_scale(layer, new_width, new_height, True)
##################

##################
# Sharpen
##################
if (sharpeness > 0):
i = pdb.plug_in_sharpen(image, drawable, sharpeness)
##################

##################
# UnSharp Mask
##################
if (sharpeness == 0):
if ((radius > 0) or (amount > 0) or (threshold > 0)):
pdb.plug_in_unsharp_mask(image, drawable, radius, amount, threshold)
##################

##################
# Reinforce the Canvas Size
##################
if keep_size == True:
pdb.gimp_layer_resize_to_image_size(layer)
##################

################################################
# DO NOT EDIT BELOW THIS LINE
# Harmfull - Toxic - Radioactive
################################################
def create_tree(input_folder, output_folder):
for dirpath, dirnames, filenames in os.walk(input_folder):
os.mkdir(os.path.join(output_folder, dirpath[1+len(input_folder):]))
return

def resizeProcess(input_folder, output_folder, name_from, name_to, new_width, new_height, keep_size, sharpeness, radius, amount, threshold, image_file, image_position):

if (image_file != None):
filename, ext = os.path.splitext(image_file)
if (ext != ".png"):
pdb.gimp_message("Selected image is not a png.")
return
image_position = int(image_position) - 1

doTransform = DoTransform()

# Create the output folder structure
timestamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d_%H-%M-%S')
output_folder = os.path.join(output_folder , timestamp)
create_tree(input_folder, output_folder)

for root, dirs, files in os.walk(input_folder):
for f in files:
inputFile = os.path.join(root, f)
filename, ext = os.path.splitext(inputFile)
outputFile = inputFile.replace(input_folder, output_folder)

# Processes only images (PNG & JPG)
# Other filetypes are copied
if (ext != ".png"):
if (ext != ".jpg"):
shutil.copy(inputFile, outputFile)
continue

is_9 = (".9.png" in inputFile)

image = pdb.gimp_file_load(inputFile, inputFile)

doTransform.applyMod(image, new_width, new_height, keep_size, sharpeness, radius, amount, threshold)

if (image_file != None):
num_layers, layer_ids = pdb.gimp_file_load_layers(image, image_file)
for id in layer_ids:
new_layer = gimp.Item.from_id(id)
pdb.gimp_image_add_layer(image, new_layer, image_position)
image.layers[0] = pdb.gimp_image_merge_visible_layers(image, 0)

if (name_from != ""):
outputFile = outputFile.replace(name_from, name_to)

pdb.gimp_file_save(image, image.layers[0], outputFile, outputFile)

register(
"Battery_Batch_Creator",
"Batch process battery icons",
"Batch process battery icons",
"Kdio",
"Kdio",
"2014",
"Battery Batch Creator...",
"",
[
(PF_DIRNAME, "input_folder", "_Input Folder", "c:/gimp/in"),
(PF_DIRNAME, "output_folder", "_Output Folder", "c:/gimp/out"),
(PF_STRING, "name_from", "Replace This", ""),
(PF_STRING, "name_to", "With This", ""),
(PF_INT, "new_width", "New Width", 0),
(PF_INT, "new_height", "New Height", 0),
(PF_BOOL, "keep_size", "Keep Source Size", 0),
(PF_SLIDER, "sharpeness", "Sharpeness", 0, (0, 99, 1)),
(PF_SLIDER, "radius", "Unsharp Radius", 0, (0, 500, 0.1)),
(PF_SLIDER, "amount", "Unsharp Amount", 0, (0, 10, 0.01)),
(PF_SLIDER, "threshold", "Unsharp Threshold", 0, (0, 255, 1)),
(PF_FILE, "image_file", "Draw Image (*.png)", ""),
(PF_RADIO, "image_position", "Image Position", "1",
(("Foreground", "1"), ("Background", "2"))),
],
[],
resizeProcess,
menu="<Image>/_Theming",
)

main()

.