 I find that a lot of times you want to modify an image, resize it, cut off the edges, make it transparent or something else like that. You want to do some basic manipulation to an image or maybe many, many images and it's sort of a pain to open all those up in an image editor. Now the tool that you use to solve this is of course image magic. I've talked about image magic before on my channel. Image magic is a command line utility for manipulating images and changing them without you having to open up another program. It's fantastic if you have a folder full of 100 images or even if you just have one, oftentimes running an image magic command to do what you need to do on an image is much faster than using some kind of graphical program. Now let me give you a little use case here. I have a couple, one thing I actually have on my computer, I should show you, I have a little folder here where I have a bunch of logos and the reason I have this is just because sometimes I use them in thumbnails or something like that. So that's one, I keep this little folder of logos and they're all to a specific specifications, specific specifications, specific specification. Now I have some other logos here but they're not up to the specification. What I mean by that is if you look at this Firefox logo, okay it looks good but I don't really like all these edges being on it. I think that's sort of annoying. I don't like when I'm putting this logo in an image, I don't want to have to deal with all the white space on the side or transparent space. Same thing, I have this Windows logo where first off it's not even transparent. I think this was originally a JPEG frankly but this is not transparent, it's just actual white and there's a bunch of white space on the side. So I'd like to be able to get rid of that stuff automatically and additionally have a little word logo here as well and this is just the same, it is transparent but it's the same as the Firefox logo and there's a whole lot of space on the side. So let's talk about how to very quickly, automatically get rid of all of this, either make an image transparent or get rid of the extra craft on the side. And we might also talk about some other things. So let's get this party started. I'll start with the Firefox logo because again what we want to do here is trim all the stuff off the side. So the command, the typical command in image magic is convert. So I'm going to run convert and what specifically we want to do is run it with the trim option. Now what trim does, if you give it some kind of file, it's sort of like if you open up GIMP and then say crop to selection or crop to content. And it's probably the same in Photoshop or whatever else. Trim is just the exact same thing. So we can take this icon as an argument and then just give it an output file name and I'll just call that Firefox.png. So again, let's look at our original again. It has all this space on the side. But once we run trim on it, we have this new file and you'll see that the edges are only as far as they need to be to fit all of the actual content. So there's none of that messy white space or transparent space, however you want to think about it. Now again, we can do the same thing with the word icon, which again has the same issue here. So we can run trim on the word or why is it called word trim? It's not already trimmed. I guess I meant for it to be trimmed later. But we can trim that just to run that command. And if I open this up, you will see that there now is no junky white space at all. It only goes as far as the image itself. OK, so that's very nice. That's very convenient. I actually use trim all the time. But another thing you might want to be interested in doing, again, I showed you this Windows logo. And the Windows logo has, it is not even transparent. So how can you make an image transparent just on the command line? Well, it's relatively easy with image magic. So I can say convert and you can give it the transparent option. And after that, you give it some kind of color that you want to be transparent. So I'm going to say white because all of that stuff is white. So I can say white, then Windows Original, and then I'll say Windows.png. And we'll run that and we'll see what that looks like. And you'll see that, well, I guess it's sort of doing what we want it to do. It's made white transparent. But there's a bunch of white here that isn't, I mean, the reason that not all of this is transparent is because this is not perfectly white. It's off-white or something. So that's not exactly what we want. But you don't have to go and open up GEMP. You don't have to resort to something so terrible as opening a graphical user interface program. Because what we can do is we can also say something like, we can give image magic the fuzz option. And I can say something like fuzz and then I'll say 10%. And what that means in effect is a match 10% of the colors that are similar to it, if that makes sense. I mean, if you think of colors on a scale or something, 10% of them, if it's so close to white, just treat it as white, make it transparent. So I'm gonna run that again. And if we open it now, you'll see that it is much better. There is still a little bit of white on the edges here, but in general, this is pretty much a good transparent image at a distance might not even be that obvious. And then of course you can tweak around with the number of fuzz you give it. You can give it say 50 fuzz or something like that. And that's gonna, there is still a little bit more there, but it's basically good. Now if you give it 100 fuzz, you might be able to guess what that's gonna do. But just if you run it, there's nothing, not gonna be anything there because you now told it to match 100% of the colors on a scale that might match white where that is basically everything. But anyway, that's how you basically do it. Now additionally, now as I said before, let me run the 50% command again. And we still have the windows thing here, but we didn't actually trim the edges. Just bear in mind that you can run multiple of these commands together. So you can say something like convert and give it the trim option and give it the transparent option and run that. And you'll see that now this is transparent and it's also trimmed. So that's pretty much exactly what we want. Anyway, so that's about it, but I will probably do another video on image magic in just a little bit in a couple of days on how to create images made out of text and stuff like that. But hopefully this is pretty useful to some of you guys. Again, you can't easily do everything in image magic, but there are a lot of basic operations like again, trimming, transparency and stuff that you can get a whole lot of just using a couple of these commands. So I recommend putting them to different aliases or making scripts with them because I use this kind of stuff all the time. Anyway, well, I'll see you guys.