logo
    
p3

Batch Rendering on Windows: Part 2

May 12th, 2010

In the previous post, we’ve discussed the simplest batch rendering that takes a series of front images and render a series of shapes. But what if you need to assign images for both front and, for example, left sides? Here are some solutions:

Method #1: Two folders

I assume that you already created a “batch” folder from the previous post, so now copy it to “batch2″. Then rename “images” subfolder to the “front” one and create another subfolder, called “left”. Now you need to place files for the left side to the second subfolder, and files should have exactly the same names. I.e. if you have file1.jpg, file2.jpg and file3.jpg in the “front” folder, you should place left side images with names file1.jpg, file2.jpg, file3.jpg as well. Box Shot 3D will render the project using the pairs: front\file1.jpg + left\file1.jpg and so on.

Now open the script file “go.cmd” and change the second line, so the whole file looks like below:

SET BOXSHOT="c:\program files\BoxShot3D\BoxShot3D.exe"
FOR %%p in (front\*.jpg) DO %BOXSHOT% -side Front front\%%~np.jpg -side Left left\%%~np.jpg -t out\%%~np.png -q 1 -fit project1.box3d

Do not forget to add “-q 1″ parameters for the testing purposes. Remove it when you see that everything works fine.

The idea behind the script is quite simple. %%p from the previous script means “the whole name of the file”. %%~np means “just a name, without path and extension”. So we iterate through the contents of the “front” subfolder, find all JPEGs there and then build paths to the same files in the “left” subfolder.

Method #2: A separate subfolder for each job

Another method is to create subfolders for each rendering. For example create subfolders job1, job2, job3, .. , jobN each containing side images for a single rendering: front.jpg, left.jpg and top.jpg. You should get something like this:

  • job1
    • front.jpg
    • left.jpg
    • top.jpg
  • job2
    • front.jpg
    • left.jpg
    • top.jpg
  • job3
    • front.jpg
    • left.jpg
    • top.jpg

Now open the “go.cmd” file and change it according the following example:

SET BOXSHOT="c:\program files\BoxShot3D\BoxShot3D.exe"
FOR /F %%p in ('dir /a:d/b job*') DO %BOXSHOT% -side Front %%p\front.jpg -side Left %%p\left.jpg -side Top %%p\top.jpg -t out\%%p.png -q 1 -fit project1.box3d

This code is a bit more complex, because FOR instruction doesn’t allow to iterate folders directly, so we have to call DIR with some switches to get the list of “job*” subfolders. The rest is quite simple, we even don’t need to use %%~np, because our DIR command returns clean names without paths.

Conclusion

More complex scenarios are possible as well. For example, you may name files like: [job_id]_front.jpg, [job_id]_left.jpg and so on. But such names are too complex to parse by CMD files. This can be done using JavaScript and Windows Scripting Host and if anyone interested, I will post a simple example.

Your Comments:

1. Michael  [+]
May 13th, 2010 at 3:23 am
 

These last two posts have been very helpful. So far I have not needed batch processing but it is great to know that the feature is available. As I use Boxshot3D more I am sure I will be using this feature.

Thanks for the product and the post!

2. art  [+]
May 19th, 2010 at 7:26 am
 

any plans on adding headers to go with ebook designs?

3. Vitaly [Box Shot 3D]  [+]
May 19th, 2010 at 7:31 am
 

art, do you mean design templates?

Leave A Comment:

Name: *
E-Mail (private): *
Website:  
Comment: *
   
Version 3.0.2, Size: 15.2Mb
Windows XP/Vista/7
Version 3.0.2, Size: 7.72Mb
Universal binary, OS X 10.5+
Order the full version of
Box Shot 3D securely online
© 2005-2010 BoxShot3D.com