Converting Slices to Cropped Layers

JC
Posted By
John_cranmer
Feb 14, 2007
Views
2892
Replies
5
Status
Closed
I have a problem. I am preparing large numbers of bitmap artwork for animation in After Effects and I’m looking a quick way to cut up large files (15000 by 15000 pixels) into smaller squares (2500 by 2500 pixels) that each sit on a separate layer.

The idea is that After Effects can easily animate the smaller tiles and avoid the memory buffer issues you get with very large files.

I’ve never used slices before but I noticed that if I create guide lines then Photoshop can auto-slice up the image along the guidelines into exactly the proportions I’m after.

So my question… is there any easy and quick way to turn these auto slices into cropped layers?

Previously I’ve gone through each file and manually cropped each square (with guides added and snap to guides enabled) and then copied and pasted it. This does exactly what I need but it is painfully slow and I’ve a lot of images to work on. If you cut and paste Photoshop centres the layer but I need it to sit right above where it came from and for the layers to appear to be one seamless image.

Does anyone have any ideas on this?

Many thanks.

John

Must-have mockup pack for every graphic designer 🔥🔥🔥

Easy-to-use drag-n-drop Photoshop scene creator with more than 2800 items.

DP
Daryl_Pritchard
Feb 14, 2007
John,

A similar question was posted recently, simply about converting slices to layers, but PS provides no such tool that can be applied to anything more than creation of a single layer from the slices. While an action can be made to expedite the process yet still requiring individual, manual selection of each slice, it isn’t a practical solution for someone needing to process many slices in that fashion.

I’m not sure what the best approach would be for you, but so long as you’re simply cutting up your image into fixed-sized, layered "tiles" and not concerned about the image content of each tile, it seems to me that it should be possible to create an action to do that. If all files are 15K x 15K pixels and you want to create tiles of 2500×2500 pixels, that should lend itself pretty readily to creating a fixed selection, cutting to a layer, reselecting the original layer, shifting the selection, and repeating the process until all layers are created. Scripting of some sort, which I’m not familiar with, seems it should also lend itself well to this kind of task. Perhaps someone can contribute some ideas in that direction.

Regards,

Daryl
JC
John_cranmer
Feb 14, 2007
Many thanks for that. I did search the net and this forum before posting but didn’t come across anything. My scripting skills aren’t so good either… so I guess now it’s a trade off between how long it takes to do the job manually and how quickly I can learn how to script!!!

wrote in message
John,

A similar question was posted recently, simply about converting slices to layers, but PS provides no such tool that can be applied to anything more than creation of a single layer from the slices. While an action can be made to expedite the process yet still requiring individual, manual selection of each slice, it isn’t a practical solution for someone needing to process many slices in that fashion.

I’m not sure what the best approach would be for you, but so long as you’re simply cutting up your image into fixed-sized, layered "tiles" and not concerned about the image content of each tile, it seems to me that it should be possible to create an action to do that. If all files are 15K x 15K pixels and you want to create tiles of 2500×2500 pixels, that should lend itself pretty readily to creating a fixed selection, cutting to a layer, reselecting the original layer, shifting the selection, and repeating the process until all layers are created. Scripting of some sort, which I’m not familiar with, seems it should also lend itself well to this kind of task. Perhaps someone can contribute some ideas in that direction.

Regards,

Daryl
DP
Daryl_Pritchard
Feb 14, 2007
John,

The basic concept you’d want, for a script, would be along these lines…keeping in mind I don’t know the syntax of any commands:

for y = 0 to 12500 step 2500
for x = 0 to 12500 step 2500
Select (x, y, 2500, 2500)
Layer Via Cut
Select Layer Background
next x
next y

In this example, (x, y, 2500, 2500) would be the top left x and y coordinates followed by the pixel dimensions of the selected area. It should be a very easy script to create by anyone knowing the syntax and how to invoke the desired PS commands. But, in lieu of that, an action will take some time to create but is also relatively easy. Just perform the following as you record a new Action:

1. Select All

2. Transform Selection, defining in the Options palette the top left corner, X = 0 px, Y = 0 px, W = 2500 px, H = 2500 px, and apply.

3. Layer Via Cut ==> LAYER 1 created

4. Select Layer Background

and repeat, but modifying X and Y for each selection transform

X = 2500 px, Y = 0 px ==> LAYER 2
X = 5000 px, Y = 0 px ==> LAYER 3…
X = 7500 px, Y = 0 px
X = 10000 px, Y = 0 px
X = 12500 px, Y = 0 px ==> LAYER 6
X = 0 px, Y = 2500 px ==> LAYER 7…

and so on until X = 12500 px and Y = 12500 px for the 36th layer.

The PC I’m on has insufficient RAM to create a 15000×15000 image and work with it quickly, so I made an image 1500×1500 for which I created 250×250 layers and created an action that does the first 12 layers. You can download that from <http://ambress.com/photoshop/PhotoTiles.atn> and load that action to see how it works.

Daryl
DP
Daryl_Pritchard
Feb 14, 2007
Hmmm…

Those boundaries I spoke of are apparently due to the selection overlap that occurs with each successive selection transformation. I’m not sure how to avoid it without explicitly defining the selection areas and ofsetting them by 1 pixel each successive time. Perhaps the impact wouldn’t be noticeable on a large image that is 15000 pixels on each edge.

Daryl
LL
Larry_Ligon
Feb 14, 2007
John,

I’ve been working on a script to do just this.

Go to this web site and register as a user. Send me a personal message and I’ll let you have a sneak peek at my script.

http://www.ps-scripts.com/bb/

Larry Ligon

How to Master Sharpening in Photoshop

Give your photos a professional finish with sharpening in Photoshop. Learn to enhance details, create contrast, and prepare your images for print, web, and social media.

Related Discussion Topics

Nice and short text about related topics in discussion sections