View Full Version : Tile Camera Auto Restitcher script for Photoshop
09-18-2009, 06:07 PM
A while ago, I lamented that there was no way to reassemble tiles rendered by the Tile Camera. I had a 50,000x20,000 pixel print image with GI, AO and glass that would have been impossible to render on a single machine. And reassembling all the multi-pass tiles by hand would have taken hours. And since there are no overlapping pixels, traditional stitching software is useless.
I posted this problem over at Adobe's Photoshop scripting forum. A programming whiz named Paul Riggott came up with this amazing script that completely automates Tile Camera restitching.
Just place this .jsx into your Photoshop>Presets>Script folder. It'll appear in your File>Scripts menu on relaunch.
Just a couple caveats:
1) It expects a single layer image. If you render multi-pass, be sure to have multi-layer turned off. Render each pass to its own single-layer file.
2) It expects to have only the images needed for a single pass in the search folder. So if you render out multi-pass, you must put each pass into its own folder.
3) It expects the total number of tiles to be evenly dividable into a square root. So your total number of files in each folder should equal the C4D Tile Camera "Tiles Per Axis" value squared (Tiles Per Axis˛).
It's been tested with Photoshop CS4 & CS3 (on Windows and Mac [Tiger & Leopard]). I've tested it with 8bpc, 16bpc, and 32bpc renders to TIFF, PSD and OpenEXR and it works perfectly and is very fast. I've also tested it with as many as 1000 tiles at 1:1, 16:9 and 4:3 aspect ratios and up to 55,000 × 35,000 pixels. The script is smart enough to handle any number of tiles or dimensions. Just make sure all the tiles are the same size (which is how the Tile Camera works anyway)
09-18-2009, 06:31 PM
Thanks! Works a treat.
09-18-2009, 08:36 PM
Tested with Mac CS2. Works great. Thanks to you and Paul Riggott!
09-18-2009, 09:53 PM
Thanks you are a "money saver": actually in the office we were thinking to buy stitcher.
thanks again for sharing this very handy script.
09-18-2009, 11:49 PM
Oh my word that would've been handy very recently! It will however be going into my alltime essential plugs, thanks for sharing!
10-12-2009, 09:39 PM
marquee, set guides, move the layers, zoom in to be sure, etc...
What a great script!
02-08-2010, 01:54 AM
Hi, this is truely a great script and exactly what Im looking for. My only problem with this script is that it doesnt carry over the alpha channels from all of my images. How can that be done?
thanks in advance
02-08-2010, 04:18 AM
Try either using "Separate Alpha" in the render setup panel or use Object Buffers.
If a re-render is too time consuming, you could also write a Photoshop action that cut and pastes the alpha channel into an image layer, then run the stitching script.
02-08-2010, 07:08 AM
Sounds like a real handy script. :)
02-12-2010, 07:12 PM
I had a 50,000x20,000 pixel print image
Did the image really need to be that big? Is there a printing device that can print that detail?
Photographs can be scaled up to fit on the side of building and they never contain that many pixels. I would love to know what it was used for?
08-25-2010, 09:51 AM
Ok in the first place I'm not using this script in quite the same manner as people in this forum might. I have been maintaining the map files for an online game which are .png files generated from 128x128 .png terrain files. There are only 25 files per terrain directory but there are over 1600 directories in the overall terrain directory.
I work in Windows 7 so I had to change 2 things to get the script to work for me I had to change the font for the dialog and I had to add png to the file type that is looked for in the directory.
I had previously been doing this with PaintShop Pro which is a 32 bit program that stopped working well in Win 7.
08-28-2010, 01:48 PM
what a amazing tool. Tank you for sharing it.
02-23-2011, 10:33 AM
How does Cinema render out those tiles? Im using maya and try to use the script. I currently render tiles like this: starting in the top left corner, then going from top left to top right corner split up into tiles, and then maya renders the next row from left to right.
At the moment the rows are split up into 4 segments. ( well added an image which shows how im rendering at the moment , starting from 00 to 03 then the next row 10 - 13)
Or does cinema create those tiles starting from bottom left corner of the image, or does this not matter for the script?
Also do I have to name the tiles in a specific way ?
02-23-2011, 11:21 PM
It sounds like your setup is correct. The way the Tiled Camera works in Cinema is that each tile is actually a frame of animation. So at frame 0000, the camera is at the top left. For frame 0001, it moves one tile to the right. Until it reaches the far right. Then it jumps down a line and moves to the far left to start the next line.
And that's the naming convention too: filename-nnnn.ext
It's smart enough to know hyphens and spaces or leading zeroes. I think double periods might hang it up. (Like Maya's "Image.0001.tif" option)
The script expects the total number of frames in a folder to be an evenly dividable square root. I think it still stitches tiles together if it isn't. It just keeps working until it runs out of tiles.
So yeah -- top left tile = frame 0 Bottom right tile = frame (vertical number of tiles x horizonal number of tiles)
Hope this helps. Let us know how it turns out!
02-24-2011, 11:03 AM
Well its not quite working at the moment. Initially my naming of my tiles was like this : tilecamera00renderlayer.png.
then for the next tiles i just used the number from the attached picture one post above. ( tilecamera01renderlayer.png )
Well i added the png file extension to the script in the line
var fileList = inputFolder.getFiles(/\.(jpg|tif|eps|psd|exr|png)$/i); since i rendered in png. Maybe i try with tif next.
When I rename my tiles to renderlayerName-0000.png the script attaches the images but all messed up, probably because I didnt render those tiles , which are empty. So the order of the tiles is wrong, also the resolution of my final image is then not correct, beause of those missing tiles i guess.
Also tried to save empty png files from photoshop , for those parts which have nothing in it. But when I try to join those with the script, all I get is a white square in the top left corner.
Well I attach some images , its easier to understand then :)
So this is how i wanted it to look, the white lines are the tiles. Manually did this in PS , maybe they show up because i resized it, the final image would be 24000px x16800 pxhttp://forums.cgsociety.org/attachment.php?attachmentid=159934&stc=1.png
this is when I use the script, here I only got the tiles in the folder, which have something visible in it.
Obviously the output image has then the wrong size, somthing like 14000px x12000px. I also always end up with a white square in the top left corner.
well im quite close lol. But when I try to use the script, with empty png files for those parts where nothing renders, I only end up with a white square, where the first tile would be. But at least the output image is the right size, 24000px x 16800 px.
( the below image is a png file with transparencies )
And the naming was Renderlayer-0000.png Renderlayer-0001.png etc til Renderlayer-0015.png starting from the left top corner.
and I also tried Renderlayer-0001.png to Renderlayer-0003.png for the first row
Renderlayer-0010.png to Renderlayer-0013.png for the second row
Renderlayer-0020.png to Renderlayer-0023.png for the third row
and Renderlayer-0030.png to Renderlayer-0033.png for the last row , its 4 tiles per row .
Well I use PS CS3 and maybe this script doesnt support transparencies?
Well sorry if this all sounds confusing. I keep trying :)
how I numbered the tiles:
http://img6.imagebanana.com/img/w6h8w3m3/thumb/tiles.jpg (http://www.imagebanana.com/view/w6h8w3m3/tiles.jpg) and http://img6.imagebanana.com/img/weawlu8y/thumb/tiles_numbers.jpg (http://www.imagebanana.com/view/weawlu8y/tiles_numbers.jpg)
05-16-2011, 07:34 PM
The problem I see in your setup is that neither 33 or 15 can be factored into a square root. You need to have the same number horizontal and vertical tiles. So 4x4=16, 5x5=25, 6x6=36, 7x7=49, 8x8=64, etc.
has anyone tested this script with CS5... i've tried but seems not to work
06-20-2011, 04:27 AM
Works fine in CS5 Mac here.
Well, here it gives me>>>
Error 510: Invalid font name 'Times'
-> win.panel0.title.graphics.font =
So I've just changed "Times" to "Arial" and all OK. Strange is that i've Times.ttf installed, which has a name Times New Roman? I'm on Win7.
Now it works.
08-04-2011, 07:42 PM
How did I miss this!?
This is such a time saver
Cheers / Alex
08-04-2011, 07:42 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.