| 1 | <h1 id="batch-exporter-krita-plugin-for-game-developers-and-graphic-designers">Batch Exporter: Krita Plugin for Game Developers and Graphic Designers</h1> |
| 2 | <p>Free Krita plugin for designers, game artists and digital artists to work more productively:</p> |
| 3 | <ul> |
| 4 | <li>Batch export assets to multiple sizes, file types, and custom paths. Supports <code>jpg</code> and <code>png</code>.</li> |
| 5 | <li>Rename layers quickly with the smart rename tool</li> |
| 6 | </ul> |
| 7 | <h2 id="batch-export-layers">Batch Export Layers</h2> |
| 8 | <p>Batch Exporter exports individual layers to image files based on metadata in the layer name. The supported options are:</p> |
| 9 | <ul> |
| 10 | <li><code>[e=jpg,png]</code> - supported export image extensions</li> |
| 11 | <li><code>[s=20,33.333,100,150]</code> - size in <code>%</code>.</li> |
| 12 | <li><code>[b=false]</code> or <code>[b=no]</code> - disable bilinear filtering when scaling layers.</li> |
| 13 | <li><code>[p=path/to/custom/export/directory]</code> or <code>[p="path with spaces"]</code> - custom output path. Paths can be absolute or relative to the Krita document.</li> |
| 14 | <li><code>[m=20,30,100]</code> - extra margin in <code>px</code>. The layer is trimmed to the smallest bounding box by default. This option adds extra padding around the layer.</li> |
| 15 | <li><code>[t=false]</code> or <code>[t=no]</code> - disable trimming the exported layer to the bounding box of the content. This option is not inherited from parent layers.</li> |
| 16 | <li><code>[i=false]</code> or <code>[i=no]</code> - disable parent metadata inheritance for a layer. More info <a href="#layer-inheritance">below</a>.</li> |
| 17 | <li><code>[icc=name_of_color_profile.icc]</code> - selects a specific color profile when exporting, defaulting to <code>sRGB-elle-V2-srgbtrc.icc</code></li> |
| 18 | </ul> |
| 19 | <p>A typical layer name with metadata looks like: <code>CharacterTorso e=png m=30 s=50,100</code>. This exports the layer as two images, with an added padding of 30 pixels on each side: <code>CharacterTorso_s100_m030.png</code>, and <code>CharacterTorso_s050_m030.png</code>, a copy of the layer scaled down to half the original size.</p> |
| 20 | <p>All the metadata tags are optional. Each tag can contain one or multiple options separated by comma <code>,</code>. Write <code>e=jpg</code> to export the layer to <code>jpg</code> only and <code>e=jpg,png</code> to export the layer twice, as a <code>jpg</code> and as a <code>png</code> file. Note that the other tag, <code>p=</code> has been left out. Below we describe how the plugin works.</p> |
| 21 | <h2 id="getting-started">Getting Started</h2> |
| 22 | <p>Batch Exporter gives two options to batch export layers: <code>Export All Layers</code> or <code>Export Selected Layers</code>.</p> |
| 23 | <p><code>Export All Layers</code> only takes layers with the <code>e=extension[s]</code> tag into account. For example, if the layer name is <code>LeftArm e=png s=50,100</code>, <code>Export All Layers</code> will take it into account. If the layer name is <code>LeftArm s=50,100</code>, it will not be exported with this option.</p> |
| 24 | <p><code>Export Selected Layers</code> exports all selected layers regardless of the tags.</p> |
| 25 | <p>By default, the plugin exports the images in an <code>export</code> folder next to your Krita document. The export follows the structure of your layer stack. The group layers become directories and other layers export as files.</p> |
| 26 | <blockquote> |
| 27 | <p><strong>Supported layer types:</strong> paint, vector, group & file layers.</p> |
| 28 | </blockquote> |
| 29 | <h2 id="smart-layer-rename-tool">Smart Layer Rename tool</h2> |
| 30 | <p>Say we have this Krita document structure:</p> |
| 31 | <pre><code>GodetteGroupLayer |
| 32 | +-- HeadGroupLayer |
| 33 | +-- Hair |
| 34 | +-- Eyes |
| 35 | +-- Rest |
| 36 | +-- Torso |
| 37 | +-- LeftArm |
| 38 | +-- RightArm |
| 39 | Background</code></pre> |
| 40 | <p>If you want to export <code>GodetteGroupLayer</code>, <code>HeadGroupLayer</code>, <code>Torso</code>, <code>LeftArm</code>, and <code>RightArm</code>, but not the other layers, you can select these layers and write the following in the <code>Update Layer Name</code> text box: <code>e=png s=40,100</code> and press <kbd>Enter</kbd>. In this example, Art Tools will export two copies of the selected layers to png at <code>40%</code> and <code>100%</code> scale. This is what <code>s=40,100</code> does.</p> |
| 41 | <p>Say that we made a mistake: we want to export to <code>50%</code> instead of <code>40%</code>. Select the layers once more and write <code>s=50,100</code> in the text box. Press <kbd>Enter</kbd>. This will update the size tag and leave <code>e=png</code> untouched.</p> |
| 42 | <p>The tool can do more than add and update meta tags. If you want to remove <code>GroupLayer</code> from the name on <code>GodetteGroupLayer</code> and <code>HeadGroupLayer</code>, select them and write <code>GroupLayer=</code> in the text box. Press <kbd>Enter</kbd> and the <code>GroupLayer</code> text will disappear from the selected layers.</p> |
| 43 | <p>The <code>=</code> tells the tool to search and replace. <code>this=[that]</code> will replace <code>this</code> with <code>[that]</code>. If you don’t write anything after the equal sign, the tool will erase the text you searched for.</p> |
| 44 | <p>The rename tool is smarter with meta tags. Writing <code>e=</code> will remove the extension tag entirely. For example, <code>Godete e=png s=50,100</code> will become <code>Godette s=50,100</code>.</p> |
| 45 | <h2 id="coa-tools-format">COA Tools format</h2> |
| 46 | <p>The exporter will generate the necessary sprite contents and metadata file for easy import in COA Tools / Blender.</p> |
| 47 | <p>If you want to export your krita document to COA Tools format, simply click the <code>Document</code> button under COA Tools.</p> |
| 48 | <p>If you want to export multiple or specific COA Tool documents from one Krita document (if you have e.g. multiple characters in one Krita document), you can do so by selecting a Group Layer to serve as root for each COA Tool export you want done.</p> |
| 49 | <h3 id="example">Example</h3> |
| 50 | <p>You want to export two characters from the same Krita document in one go</p> |
| 51 | <pre><code>Root |
| 52 | +-- Robot (Group Layer) <-- Select this layer |
| 53 | | +-- Head |
| 54 | | +-- Body |
| 55 | | +-- Legs |
| 56 | | |
| 57 | +-- Sketches |
| 58 | | +-- ... |
| 59 | | |
| 60 | +-- Minion (Group Layer) <-- ... and this layer |
| 61 | | +-- Hat |
| 62 | | +-- Head |
| 63 | | |
| 64 | Background</code></pre> |
| 65 | <p>Once the Group Layers are selected you push “COA Tools -> Selected Layers”.</p> |
| 66 | <p>Each export root supports the following metadata:</p> |
| 67 | <ul> |
| 68 | <li><code>[p=path/to/custom/export/directory]</code> - custom output path. Paths can be absolute or relative to the Krita document.</li> |
| 69 | </ul> |
| 70 | <p>Each child node of an export root supports the following metadata:</p> |
| 71 | <ul> |
| 72 | <li><code>[e=jpg,png]</code> - supported export image extensions</li> |
| 73 | </ul> |
| 74 | <p>Generating frames to a sprite sheet from a Group Layer is also possible. Simply mark the layer containing each frame you want in the sheet with a <code>c=sheet</code> and each child layer will act as one frame you can switch when Working with COA Tools in Blender.</p> |
| 75 | <h3 id="example-1">Example</h3> |
| 76 | <p>You want to export a character from the document, and be able to switch between each state of e.g. the mouth:</p> |
| 77 | <pre><code>Root |
| 78 | +-- Robot (Group Layer) <-- If this is the export root |
| 79 | | +-- Mouth States c=sheet <-- ... mark this layer |
| 80 | | | +-- Open |
| 81 | | | +-- Half Open |
| 82 | | | +-- Closed |
| 83 | | | |
| 84 | | +-- Head |
| 85 | | +-- Body |
| 86 | | +-- Legs |
| 87 | | |
| 88 | Background</code></pre> |
| 89 | <h2 id="layer-inheritance">Layer Inheritance</h2> |
| 90 | <p>Batch Exporter now allows child layers to inherit metadata from parent layers without the <code>e=</code> tag. This makes it easier to manage documents with lots of layers and results in cleaner looking layer names.</p> |
| 91 | <p>Any layers tagged with <code>i=no</code> or <code>i=false</code> will not inherit metadata from their parent layers. Tagged group layers will still share <strong>their own</strong> metadata with their children.</p> |
| 92 | <h3 id="example-2">Example</h3> |
| 93 | <p>Consider the following document structure:</p> |
| 94 | <pre><code>Background e=png m=5 s=50,100 p=assets/images |
| 95 | |
| 96 | InterfaceGroupLayer |
| 97 | +-- ui_skin e=png m=5 s=50,100 p=assets/images/interface |
| 98 | +-- ui_skin_dark e=png m=5 s=50,100 p=assets/images/interface |
| 99 | |
| 100 | MapsGroupLayer |
| 101 | +-- map01 e=png p=assets/images/interface/maps |
| 102 | +-- map02 e=png p=assets/images/interface/maps |
| 103 | |
| 104 | MobsGroupLayer |
| 105 | +-- mob01 e=png,jpg m=10 s=75 p=assets/images/mobs |
| 106 | +-- mob02 e=png,jpg m=10 s=25 p=assets/images/mobs</code></pre> |
| 107 | <p>Using metadata inheritance, you could achieve the above like so:</p> |
| 108 | <pre><code>InterfaceGroupLayer m=5 s=50,100 p=assets/images/interface |
| 109 | +-- ui_skin e=png |
| 110 | +-- ui_skin_dark e=png |
| 111 | +-- Background e=png p=assets/images |
| 112 | |
| 113 | MapsGroupLayer p=assets/images/interface/maps |
| 114 | +-- map01 e=png |
| 115 | +-- map02 e=png |
| 116 | |
| 117 | MobsGroupLayer p=assets/images/mobs m=10 |
| 118 | +-- mob01 e=png,jpg s=75 |
| 119 | +-- mob02 e=png,jpg s=25</code></pre> |