ArtRage 5 Product PageArtRage Lite Product PageArtRage for iPad Product PageArtRage for Android Product PageArtRage  Android Oil Painter Free Product PageArtRage  Free Demos Page

Results 1 to 7 of 7

Thread: Export all layers as individual files.

  1. #1
    Join Date
    Feb 2013
    Location
    Sweden
    Posts
    537

    Export all layers as individual files.

    I made a script to export all layers as individual files. The image size was 1280 x 800 pixels at 72 dpi. 4 layers. It worked fine. All layers were exported at the right filesize, the right type of file, and with the given names.

    The problem is: what if I want to use the same script on many more layers and higher resolution? This is what happens: all files are exported as blanks. Nothing to see in them.

    So: is it possible to make a script that automaticly give names to all the layers, exports all layers there are, and exports all of them at any given size and as as the given file type?

    Anyone? Please!?

    This is why: I am working on Storybook apps. I make some layers for each page, like background, middleground, foreground, characters, furniture, cars, birds...and so on, each one on a separate layer. Some are going to be animated later as png sprites. All assets are supposed to be separate images from separate layers. Mabe I make 20 pages or 30, it's a lot of job not only painting it all, they all have to have different size. Example: iPad has a different screen size than Android (in fact there are several iOS screen sizes, just as there are different Android screen sizes), Nook got another as well as Kindle. All got different screen ratio aspects too. That is much to do if you have to make it all manually.

    I start out making the biggest and crop them down to each aspect ratio and downsize them inside Photoshop using Kutt. But I rather use ArtRage. If there was a script to do this kind of "McDonald" job in ArtRage I would be glad. Instead of being forced to use Photoshop and Kutt.
    Last edited by Henry Stahle; 02-19-2014 at 01:09 AM.

  2. #2
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,502
    Could you zip the script up and send it to me at dave@ambientdesign.com so I can take a look?
    Dave
    Resident Bug-Hunter
    Ambient Design

  3. #3
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,502
    After looking the file, this script was created via recording in ArtRage. Scripts recorded in ArtRage will play back by creating a new painting of the original specified size or a new size specified by the user when the script is played back. ( the 'original size' option you see when you start playback )

    Here's what to do:

    Open your script file in notepad if you're on Windows or textedit if you're on a Mac.

    Locate this block:

    <Header>
    // === Project data
    Painting Name: "Untitled"
    Painting Width: 1280
    Painting Height: 800
    Painting DPI: 72
    Mask Edge Map Width: 1920
    Mask Edge Map Height: 1200
    // === Author data
    Author Name: "HS"
    Script Name: "Export Layers"
    Comment: "Export layers as individual png files"
    Script Type: ""
    Script Feature Flags: 0x000000034
    </Header>

    Either set Script Feature Flags to 0x000000000 or delete this line entirely

    Save the script with a new filename. You can now use it to export the first four layers from files of any size. This script will only export four layers as this is what was recorded. You can add additional layers by editing the <Events> section

    e.g.

    Wait: 5.132s EvType: Command CommandID: ExportLayer Idx: 3 Channels: NO Path: "C:\Users\xxxxx\Desktop\Layer 4.png"

    This exports layer 4 to the specified path. You could add another line below, changing the Idx value to 4 ( layers start at 0 so this would be layer 5 ) and export it as Layer 5.png and so on.

    You could in theory program a script to export all the layers of the painting by getting the number of layers, then doing a loop ( see the document below ). Script programming isn't something I can provide support for however. Alternatively you could add a number of further layer export entries then just press the stop button during playback when you have exported the last layer.

    You can find more information on advanced script programming here:

    http://www.artrage.com/files/artrage...ptingguide.pdf

    I hope this helps!
    Dave
    Resident Bug-Hunter
    Ambient Design

  4. #4
    Join Date
    Feb 2013
    Location
    Sweden
    Posts
    537

    Thank you!

    I think I get it, although there is an issue with me and scripting and coding. I will try to get it right. Thank you very much for your help.

  5. #5
    Join Date
    Jun 2016
    Posts
    1

    Script documentation

    Hi! That's an amazing capability! Where are commands like ExportLayer documented? How would one figure those out?

  6. #6
    Join Date
    Nov 2013
    Location
    Auckland, NZ
    Posts
    1,791
    Quote Originally Posted by rmartinr View Post
    Hi! That's an amazing capability! Where are commands like ExportLayer documented? How would one figure those out?
    The commands aren't documented publically anywhere, the best and quickest way to start a script and figure out the commands you want is to create a practice one (i.e. do the things you want in ArtRage and record it), then edit the document it gives you.
    Ambient Design Tech Support & Community Manager

    This is not my signature.

    Go forth and read the tutorials. Also, check out the featured artists!

  7. #7
    Join Date
    Apr 2017
    Posts
    1

    Script to export separate layers

    I'm trying to export separate layers too. So far, I have the script below, and it's working OK. It exports only named layers. The script is so simple, I'm amazed this function is not built in!

    If anyone knows how to get the current painting's filename and path as the baseName, or some other way I can replace the InputBox with something more elegant, help would be much appreciated.

    Code:
    <Events>
    
    int i;
    string baseName;
    string layerName;
    string fileName;
    flag overwriteExisting = false;
    
    InputBox( "Base name: $$baseName" );
    
    for ( i = 0; i < LayerCount(); i++ ) {
    
    	layerName = LayerName( i );
    
    	if ( layerName != "" ) {
    	
    		fileName = baseName + "_" + layerName + ".png";
    		
    		if ( FileExists( fileName ) ) {
    		
    			if ( !overwriteExisting ) {
    				overwriteExisting = YesNoBox( fileName + " already exists. Overwrite layer files?" );
    				
    				if ( !overwriteExisting ) {
    					MessageBox( "Cancelling export" );
    					exit;
    				}
    				
    			}
    			
    			if ( overwriteExisting ) {
    				FileDelete( fileName ); // overwrites existing files
    			}
    			
    		}
    		
    		Wait: 0.000s	EvType: Command	CommandID: ExportLayer	Idx: i	Channels: NO	Path: fileName	
    		
    	}
    	
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •