You are here

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

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!

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...

 

Version 0.2 :

Corrected the bug when one layer name was < 6 characters

 

Version 0.3 :

Now keep the transparency when saving to .png.  Be carefull, if you have transparent parts in a .jpg slice, as this format does'nt support alpha channel, it will be replaced b something else (black ?).

Version 0.4 :

Should work now with the layer groups.

The modification is quite untested, I hope I have'nt broke something else...   Don't hesitate to mail me !

Code License: 
GIMP Version: 
Scripting Engine: 

Comments

Thanks a lot it is a very usefull script.
I have also made a little improvment as i wished that layer or group could be hidden and not used.
If you wish to add this functionnality to your plugin please ask me i'll send you my code.
I did'nt want to create a new plugin as the base code is yours. It could be a 0.4 version supporting group (for gimp 2.7 at least)

Sorry, I don't receive notifications when a message is posted... I can't find the option...
Of course, you can send me your patch at robert@percu.be.
Thanks !

I found this script very useful , and I wonder how is it that gimp doesn't implement this function yet ; the author is encouraged to continue improving this work.
Thank you .

PNG transparency works as expected. And transparency on JPEGs turn black indeed.

Very nice job, thanks a lot!

Where i paste this plugin
Subscribe to Comments for "layers-slices - A slicing tool based on layers instead of guidelines"