Hi, this is Gary with MacMost.com. Today let's talk about creating and using
transparent images on your Mac
MacMost is brought to you thanks to a great group of more than 1000 supporters.
Go to MacMost.com/patreon. There you can read more about the Patreon Campaign.
Join us and get exclusive content and course discounts.
So when you work with graphics on your Mac you often need to use transparent images. So what
is a transparent image? Well, here I have a jpeg image that is not transparent. Let's use QuickLook
to take a look at it. Now you may say this is an image of an apple. But it's actually two things.
It's an apple on a white background. You may be tempted to say there's nothing behind the apple.
But, in fact, there's a white background behind it. All the pixels here are actually white pixels
just like the pixels in the apple are mostly red pixels. If we zoom in here on the apple
we can see the individual pixels. So each one of these squares is a pixel.
It's a single color. Now all the pixels combined when it's small enough to make the im age. We
don't really see the pixels normally. Only when we zoom in can we make out the individual ones.
So what is a pixel? A pixel is actually made up of four things. Red, green, and blue colors
and these combine to make any color of the rainbow. Also there's something called the Alpha
Channel. The alpha channel is how transparent a pixel is. So, for instance, when we have 50% red,
no green at all, and 50% blue we get purple. In this case for pure purple the alpha would be 100%.
It's a completely opaque pixel. Now you often see these colors represented as
numbers from zero to 255 instead of zero to 100%. So in this case 127 red, zero green, 127 blue and
then the pixel itself then would be represented as 127 zero 127. The alpha channel in this case
would be 255 or 100%. Another way to show those is using hexadecimal rather than decimal numbers.
So you would say 7F, 00, 7F. That's why most of the time when you deal with colors on the web
or in apps you're looking at things like 7F, 00, 7F rather giving the number for red,
green, blue. In this case 255 is FF in hexadecimal. So it's a completely opaque pixel.
Now when you have the alpha set at 100% you get a completely opaque pixel. But
if you were to change it to say 50% you get something that's semitransparent.
So the pixel blends with what's behind it according to that percentage. In this case
you have pure purple but you're only using 50% of it. 50% is the color of whatever is
behind it. If you were to move the alpha all the way to zero then it's completely
transparent. It actually really doesn't matter what the red, green, and blue values
are. The pixels are going to be invisible and showing exactly what's behind the pixel.
So let's go back to our image here. You could see if I pick out a pixel in the apple this one is
a red pixel. Not pure red. It's actually A31907. So mostly red, a little bit of green,
and a tiny bit of blue to make the result there. The alpha is 100%. This is a 100% opaque pixel.
But if this is a transparent image and instead of having white all around it it's actually
transparent outside the actual object itself. Then if I look at another pixel then it would be
an alpha of zero. It's a completely transparent pixel. In this case red,
green, and blue don't matter because the result is going to be the transparent pixel there.
So if you have an image that's like this that has a white background how do I take the white
background away so the pixels here are transparent rather than opaque. Well, you have to open it up
in an Image Editing App. Let's start by doing that in Pixelmator Pro. So I'm in Pixelmator Pro
and opened it up. Now by default Pixelmator Pro images are transparent except we've got this
white background here on our image. So to get rid of it I would choose a Selection tool.
Let's enlarge this a bit and then I'm going to choose the Square Selection Tool. Select
something and then use the Delete key to delete it. Now you can see I've got a hole here.
Behind it I see this checkerboard pattern which is typically used by image editing apps
to say there is nothing here. It's a transparent portion of the image. So I've got a hole in it but
what I want to do is get rid of all of the white. So let me Undo that and instead I'm going to use
this tool here which will allow me to do a quick selection and you could see it's going
to highlight whatever it is that it thinks should be selected. I'm going to select all
of the white like that. I can actually refine it if I want and do things like expand the selection
in either direction a little bit. If I want change the softness of the edge. Things like that. With
this area selected I could Delete. Now you could see it's all transparent outside of the image.
So what I would do now in Pixelmator Pro is go to Export. In order to get a transparent
image you need to use a format that supports the alpha channel. JPEG images do not. But what you
want to use is png for that. So I would choose png here and have it Export. Let's export that
to the Desktop. Behind Pixelmator Pro I have my original here and you could see in QuickLook it
has a white background. This png here in QuickLook it shows a transparent background. If you
look through the haze, kind of like a sheet of frosted glass, you could see that this area here
is transparent. It blends in with the top. That's just how QuickLook happens to show transparency.
Let's try this in another popular image editing app Affinity Photo. So Affinity Photo is going to
have the same thing. It's going to have a layer. This is going to be on the background of that
layer. I can select a portion of it and Delete and you can see it create a hole in there. I can also
use their selection tool here to select everything around. I can adjust it here with Refine
button. The same kind of things I would do in Pixelmator Pro. I hit Delete to get rid of that.
Then Export to Save it out. Again I want to use png format. A lot of image editing apps
will actually have a checkbox here for whether or not it's transparent or not. So you can choose to
have a non-transparent png. So make sure you're choosing to have transparent or in this case it's
just the default here in Pixelmator Pro. I'll export here. Let's save this out to the Desktop
and now you could see I've got both of these, this is the one from Pixelmator Pro and this is the one
from Affinity Photo. Both now have transparent backgrounds rather than a white background.
I also want to show you that you don't have to start off with a photo. So, for instance,
here I am in Pixelmator Pro. I'll just choose a size here for a new image. Notice I get a
background layer here that's opaque. But I don't have to keep it. Let's create a shape
and draw a shape here and then let's put some text here
like that. I could look here in the layers and see I've got those two things as layers and there's
the background layer. I'll select the background layer and delete it. You could see how now it's
a shape and some text and there's no background. So if I Export this as a png then I'm going to get
something here that is actually transparent. I can use this instead of other apps and you'll
be able to see through everything except the star and the actual letters here.
So how do you use transparent images in apps? Let's start with Keynote. Let's say you're going
to do a presentation and you want to bring in an image. So let's bring in the original image, the
jpeg here, and you could see I've got that white background now which doesn't look good in Keynote.
I want it to blend in with the background. Instead I would bring in one of the transparent images
here and you could see now it looks much better. How about in Pages. Let's say i bring in an image
like this in Pages and I want it to kind of live inside the text. I could go to Format, Arrange
and have it wrap around this. But notice how it wraps around a square there because it has to
wrap around all of the pixels. However, if instead of using that I take one of the transparent images
and I bring that in. You could see that it now wraps around the shape of the image because
it's only recognizing the pixels in there. Text is allowed to wrap around inside of the transparency.
Now you do have an option when it comes to Pages and Keynote to actually make an image
transparent inside the app. Let's bring the jpeg image in here and we can see we've got that white
background. There is something under Format, Image called Instant Alpha. When I click that
I can click inside of the background field and it will create transparency for me. You can actually
see it doing it. If I click and then drag you could see the zero percent move to a higher amount
as it takes in more of the image. So to make something that's a little bit more than zero
gives you a nicer view. As a matter of fact if I go and I put a shape behind this, so I'll Arrange,
send it back and let's have that. Have no wrapping at all. You could see here that it does
treat the white area as a completely transparent area. So you can do that in Pages and Keynote.
But that really only works when you have a completely uniform field behind something
like a white background. If you wanted to do something like cut a subject or object out
of a more complex background than using that Instant Alpha isn't going to help.
You're going to have to work inside of an app. So for instance if I brought in this jpeg image.
You can see the background is really complex and using Instant Alpha isn't going to be able to grab
exactly what I want. So what I would do here instead is that I would bring that image into
Pixelmator Pro. Even using the Quick Selection Tools here isn't really going to do a great job.
So I can go and instead define the area by dragging really carefully. Then you would
just drag and select the entire area. I'm going to do it very quickly but you would do it with much
more detail zoomed in to have really good control over exactly which pixels are in the selection.
In most apps after you've selected something you could invert the selection.
So in this case I could go to Edit and then Invert Selection. Now I've selected the
opposite. So instead of selecting me I selected the background. Now I can hit the delete key
and now that I have that background made transparent I could Export, Save it out as a png
to the Desktop there. Now when I bring this in you could see it's got that transparency there
and the text wraps around it. If I put something behind it those colors would show through.
Another place you could use a transparent image is in video editing. So in this case in iMovie I have
a Main Timeline that has a regular video. I can't really do anything with transparency there because
there's nothing behind the main timeline. But a picture-in-picture actually is on top of the
main video. So if I were to use something transparent like this apple here and put it
on top, you could see here as a cutaway or as picture-in-picture it's semitransparent. You can
actually see behind the transparent part. This is particularly useful if you create your own
graphics like we did when we created that star and the text. I put that in there you could see here
how that is now a transparent image. Very useful in video. As a matter of fact if I switch that
to picture-in-picture I now have something I could move around and place wherever I want.
So I hope this gives you a better understanding about how transparency and the Alpha Channel
work in images on computers and how you can use Image Editing Apps to cutout background,
to create holes in otherwise opaque images, and then use those transparent images inside
of a other apps like Pages, Keynote, and really anything where you can use an image.