Welcome back to Davies Media Design, and in this article I’ll be covering how to export single layers from your GIMP composition to any filetype.
Here’s an example of when you would use this: you’ve got a composition with a bunch of layers open, but you want to isolate one of the layers and export that layer to a certain filetype (i.e. PNG or a JPEG image). How do you achieve this?
In GIMP, the free photo editor, the answers are simple (there’s multiple methods). Let’s dive in!
For starters, have your composition open in a format that was created with and supports multiple layers (i.e. .XCF or .PSD documents – GIMP uses .XCF file formats by default, so if you’ve been working with a composition with multiple layers in GIMP then the file should already be open). I have about 16 layers in my example composition in the photo above (all the layers are outlined in green).
For the next step, you’ll want to isolate the layer you’d like to export. Here’s where there are multiple methods you can choose from to accomplish this.
Method 1 to Export a Layer from GIMP
For the first method, simply shift+click on the eye icon next to the layer you’d like to isolate and export. For example, if I want to export the layer with the female model (she has a yellow arrow pointing to her), I can shift+click on the eye icon next to that layer (red arrow in the image above).
You’ll now see that all the eye-icons for the other layers will be hidden, with the only icon visible being the icon we shift-clicked on. This icon is referred to as the “show/hide” icon, and shift+clicking on it is simply a shortcut for changing the show or hide status of all the other layers in the composition besides the one you click on.
So, in this case, we’ve now hidden all the other layers in our composition. We can now export the only visible layer – the one with the female model.
There’s one thing we need to note, though, before we export. The overall size of our composition has remained unchanged. It is still the size of the original image composition boundary (blue arrow in the photo above). This means that if we export the layer now, it will come out as this size (1920x1080px) and not the size of the individual layer. The second method will resolve this issue, but for the first method we’ll just export the layer at this size.
Hit shift+ctrl+e to export the layer or go to File>Export As (red arrow in the image above).
Rename the file to whatever you want (red arrow in the image above – you can either include the file extension in the name, as I did here – .png – or leave it out for now). Then, click the “Select Filetype by Extension” dropdown (blue arrow) to choose a filetype to save it as. For example, in this case I can select the “PNG Image” filetype since PNG files support transparent backgrounds. Click the “Export button in the lower right corner to export the file.
You can then shift+click on the eye icon (red arrow) once again to reshow all the layers in your composition.
Method 2 to Export a Layer from GIMP
The second method involves isolating the layer you want to export by opening it as a new composition. I’ll use the layer with the male model for this example.
To open the layer as a new composition, click and drag the layer from the Layer’s panel over to the Toolbox (follow the bottom right red arrow to the top left red arrow in the photo). Release your mouse once you are hovered over the toolbox (in newer versions of GIMP you’ll see white outlines around the top and bottom of the toolbox when hovered over it).
GIMP will open this single layer as a new composition. The size of the new composition will be the same size as the layer of the male model.
Something we need to note is that this particular layer has a layer mask associated with it (red arrow in the image above), so the layer size itself is the size of the original image hiding underneath the layer mask. If you’re not sure how layer masks work, I recommend checking out this GIMP tutorial on Layers and Layer Masks or you can read this article strictly on layer masks.
We can either export the image as-is, or we can perform a quick step to crop out the excess transparency of the image (while still keeping the layer mask intact). I’ll perform the latter option for demonstration purposes.
Go to Image>Crop to Content (red arrow in the above image) to crop out all the excess transparency around the model. You will see the image boundary shrink down to the pixels in the image (yellow arrow in the image above), thus cutting out the excess space around the model. However, if you look over in the Layers panel, the layer mask is still intact on the image (blue arrow).
Once everything is set up to your liking, you can once again go to File>Export As or use shift+ctrl+e to export the image. You can follow the steps from the end of Method 1 (shown earlier in this article) to finish choosing your filetype and exporting the layer as its own image.