layers-slices - A slicing tool based on layers instead of guidelines

This script is meant to cut an image is smaller pieces and save these images automatically based on the size and names of specific layers, images to be used in web layouts.

Other options I found are based on guidelines. This approach has 2 drawbacks for me :

  • Image used for web layout are not always a pure table. The image you needfor the banner has not the same width than the one you need for the side block, and there are "cells" of that table that you don't need
  • It's saved with an autogenerated name

If I'm wrong with this analysis, tell me...  this script is perhaps a bad duplicate of some existing plugin I don't know about...

The idea here is to create a layer for each slice you need.  This layer has 2 important characteristics :

  • It's name - which must be "SLICE-xxx" (case insensitive), where xxx is the name of the image file to create, including the extension (.jpg or .png supported)
  • It's size - no matter what is on the layer,oly it's size matter

For each of these "SLICE-*" layer, the image will be flatten (without the "SLICE-*" layers themselves), cropped to the layer's size and saved in the directory specified in the requested parameters.  For .jpg images, the compression quality is requested in the parameters.

This script is my first scheme script, and has to be considered beta quality at most...

AttachmentSize
layers-slices.scm5.89 KB

Comments

This looks really nice

Thank you for your work.

Slice plugin problem

Where i paste this plugin

Good plugin!

I like the plugin a lot. Except that it doesn't generate a html file with the table.. Any easy way to do this? Because I don't like rewriting it myself everytime I change the layout..

trouble with runnin plugin

Hi

I cant find where to change the format (png/jpeg) and 2 errors come up;
"Plug-In '(null)' left image undo in inconsistent state, closing open undo groups."

and

"Error: substring: end out of bounds: 6 "

are you familiar with this and can someone help me?

I have the same problems,

I have the same problems, gimp 2.6.6 i686 version, Win XP 64-bit

Length of all layer's names

Length of all layer's names must be greater than 6

Please add example. Can you

Please add example. Can you please provide us with an example as it is generating errors when I use the following kayer names:

SLICE-win.jpg
SLICE-tab.jpg
SLICE-bgk.jpg

Don't understand where to add the size and how to formulate it.

Following errors appeared:
"Gimp message: Plug-In 'layers-slices' left image undo in inconsistent state, closing open undo groups" and "Error while executing script-fu-layers-slices: Error: Procedure execution of gimp-image-flatten failed".

Great plugin! After looking

Great plugin!

After looking at the code I got the clue!
The slicing dimensions are determined by the size of the layer :D

As mentioned by the author naming of the layer is important.

cheers!