How To: Convert JPG to PNG

In today’s article, we’re going to learn how to convert JPG to PNG image files. It’s a pretty easy process. In fact, the second part of the article should be fairly brief. Read on to learn more!

I should also mention that we’ll be learning how to convert JPG to PNG in the terminal. There are all sorts of GUI ways to do so, from individually converting files to batch conversions. Well, you can do all that in the terminal and this article will show you how.

Why PNG? Well, it supports lossless compression. PNG also supports transparency. PNG also looks better at higher resolutions, as it is able to display more details. Additionally, PNG not only supports lossless compression, it supports compression better – so you needn’t transfer larger files if you have no reason to do so. Plus, PNG is one of the better formats if  you’re going to do things like share the images online.

So, there are a number of reasons why you’d want to convert JPG to PNG. Fortunately, as I mentioned above, it’s really not all that difficult. You have tools to do this right in your default repositories, assuming you’re using a mainstream distro.

Without further ado…

Convert JPG to PNG:

As we’ll be converting in the terminal, you will have to have an open terminal. To do that, just press CTRL + ALT + T and your default terminal should open. See? We’re off to a good start.

Now, the tool we’ll be using is ‘ImageMagick’ and it’s available to install via  your normal channels. If you were using a distro that uses apt (Debian/Ubuntu/Mint/etc) then it’s trivial to install with:

Otherwise, install it with your default package manager tools. (You just might have installed when we covered how to resize images with ImageMagick. If not, now’s a good time to install it and then read that article!)

So, next you’ll either want to use the /path/to/directory where your JPG files are,  or just navigate to the directory where you’ve stored them (the easiest path), and you can convert them all with just one command:

Congratulations, in just that one command you’ll have converted all the JPG to PNG files. Feel the power of Linux! You’ll retain the originals, just in case something goes awry. If you’re happy with the results, you can always delete the originals with any one of a number of commands.

So, what if you just want to convert one JPG to PNG? Well, that’s easy:

See? I told you it was easy. While there’s a whole lot of complexity with ImageMagick, it can be quite simple to use for some very generic day-to-day tasks. Of couse, man imagemagick is always an option to learn more.

Closure:

Yup… It’s really not all that hard to convert JPG to PNG files with ImageMagick. If it’s a large number of files, it could be a bit for you to convert them all, but let it do its thing and it won’t take too long on a modern computer. If you only need to convert one image, that’s fine too.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Find Your Graphics Card Information

Today’s article isn’t all that spectacular, but it is useful, as we’re going to discuss a few ways to find your graphics card information. That’s handy stuff to know, especially if you are new to the computer or are looking to do things like find drivers for said graphics card. This should be remarkably quick and easy, actually.

We will be using tools we’ve used before. These are simple tools, tools used to learn hardware information. Well, they can all be narrowed down to show just the graphics card information. They can also give information about other hardware, not just graphics card information.

All the tools we’ll be using should be installed by default. We will use one program that isn’t necessarily installed by default. That program will be inxi. You can learn how to install inxi easily enough, and the rest should be installed by default. If inxi is not installed, install it.

Like I said, the article should be fairly quick and easy. You only need a few specific commands. ‘Snot all that complicated, now is it? 

So, let’s take a minute to read an article that tells you how to learn more about your…

Graphics Card Information:

As is often the case, this article requires an open terminal. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With your terminal open, let’s go ahead and use the inxi command first:

See? Plenty of graphics card information.

How about we use ‘lshw’, a tool for listing hardware information? Well, the command for that would be pretty easy. You just need to specify that you want graphics card information. It looks like:

Finally, we can use ‘grep’ and ‘lspci’. We’ll also use the -k flag to list kernel drivers. It’s easy. You don’t have to memorize it, you can just refer back here later when you actually have a need for your graphics card information. It looks like:

That should do it. You can use any of those three methods (or more) to find your graphics card info. I just use on-board graphics, so a screenshot would be quite boring.

Closure:

Well, there you have it. You have yet another article. I didn’t go deep into the usage of each tool because there’s no reason to. Each program has a help file associated with it. Consult the help file if you wish to know more. This article’s goal was to demonstrate a specific use.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Reload Your .bash_profile

Today’s article is going to explain  how to reload your .bash_profile. It will be just a quick and easy article, one that won’t take up much of your time. It’s not all that complicated, but it’s something folks probably should know.

So, most of you will probably have a .bash_profile. There are other shells, but Bash is the most common. That’s where they store various bash settings. When you make changes to the .bash_profile, the profile needs to be reloaded for the changes to take effect.

I’ve probably covered this elsewhere, though I did write an article to show you how to find out which shell you’re using. If you don’t know, Bash is the name of the shell and stands for Bourne shell. There are many shells, but Bash was the first one ported to Linux. Indeed, it was one of the first applications ported to Linux. It’s still widely used as the default on most distros.

There are times when you’ll want to edit your .bash_profile for additional functionality. It’s where you’d go to change things like terminal output colors and you could even add aliases to the file if you really felt like it. (Those should probably bo in .bash_aliases, for the record.)

With that in mind, I’ll show you how to reload your .bash_profile.

Reload Your .bash_profile:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

Like I said, this won’t be a very long article. It’s not terribly complicated.

Let’s say you’ve made a change to your .bash_profile and you want it to take effect immediately. To do that, you enter one of the following two commands:

Alternatively:

You could also close all instances of the terminal and the new .bash_profile changes should take effect the next time you open the terminal. If you really want to have another way, you can reboot and the changes will take effect the next time you open the terminal as that too will reload your .bash_profile.

Closure:

See? I told you this would be a quick and easy article. It’s not all that complicated. You probably don’t need to reload your .bash_profile often, but now you know how to do so when you need to do so. Yup, it’s also another article. There are now more than 250 articles, by the way. Who knew that it’d turn into this?!?

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Let’s Learn How To Change The Open File Limit In Linux

Today, lacking anything better to do, we’re going to learn how to change the open file limit in Linux. Why would you want to do this? Buggered if I know! But, I’m gonna tell you how! (You’re welcome!)

Actually, you could be working with many files and want to increase the number of files that can be open at one time. You might also want the opposite, as a way of limiting system resources.

Basically, in Linux, anything that can use resources has some sort of limitation. For example, there’s a limit to how many arguments that can be passed in a single command or for a new process. You’re unlikely to bump into that limit as a regular desktop Linux user, but that limit is there.

Heck, if you want to learn more about that, click this. I’m not entirely sure how to change that value, but it might actually be in some notes somewhere. Someone’s gotta know how.

Again, you’re very unlikely to run into problems as regular ol’ desktop Linux user. Realistically, you’re unlikely to have to change the open file limit in Linux. However, today is the day I tell you how! Why? ‘Cause I ain’t scared – and it’s not my computer that you’re mucking about in!

I should also mention, more to remind you gentlefolk, that everything in Linux is a file. Everything… So, you’d be surprised how many files you have open at times. Even then, you still probably don’t have too much of a need to change the open file limit.

Change The Open File Limit:

Like many articles, this one requires an open terminal. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With your terminal open, now is a good time to tell you that there’s a hard limit and a soft limit. The hard limit can only be changed by root and the soft limit can be altered dynamically by the process.

You can learn those limits. To find the hard limit, use this command:

And, to find the soft limit, use this command:

Those commands will output the value of your hard and soft limits, respectively. 

You can obviously change those limits, else this wouldn’t be an article. To change the open file limit, you just add a new value as an additional argument. It’s something like:

And, again for the soft limit:

For example, you might increase the hard limit with a command like so:

If  you want to make them permanent changes, you can do that. It’s a little different for the hard limit and the soft limit. So, to make them permanent we need to use nano to do some file editing:

And add this line:

If you want to change the soft limit, it’s a little different. It’s just:

If it’s not obvious, replace the username with your username (and no brackets, of course). Then, of course, you’ll need to save the file. To do that, just press CTRL + X, then Y, and then ENTER and that’ll save the file properly.

You shouldn’t need to reboot. The changes should be immediate and you can run the above commands to verify this. If the changes somehow didn’t take effect, reboot and  you should be good to go.

Closure:

I’ve never really needed to change the open file limit as a desktop Linux user, but you might have a reason to do so. If that’s the case, it makes sense to have this information handy, and now you do.

It’s yet another article in a long, long list of articles – a list that’s growing steadily! I have yet to miss a single publication date, though I feel compelled to do so – as it’d take the pressure off knowing that I no longer have a “perfect” record.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Adjust Swappiness

In today’s article, we’re going to learn how to adjust swappiness. It’s something you might want to do, as many don’t like the initial value set by the developers. It’s relatively easy.

I’ve written about swap before. I think you’ll find the best information in my recent article telling you how to remove a swap file. In that article, I tell you why I still use a swap file – even when I have lots of RAM available.

The reason for that boils down to how a swap file isn’t just some place that the kernel sticks things when you’re out of RAM. It has other uses as well. I figure I’m not smarter than the kernel and evidence tells me that the kernel uses swap even when there’s all sorts of RAM available. So, I use a swap file (not a swap partition these days). You might also want one if you plan on using advanced power management features like hibernation or sleep.

Anyhow, one of the only settings you can change regarding swap is the ‘swappiness’ value. That setting is basically how aggressively the kernel will use swap. The higher the number, the more the kernel will use swap. The lower the number, the less the kernel will use swap. It’s pretty basic in theory.

I don’t actually normally adjust the swappiness value. It works just fine at the default setting, so it doesn’t seem to me like I need to adjust it. Other people adjust it, and that’s fine. Either way, I’m going to tell you how to adjust the swappiness value. You do what you gotta do.

Adjust Swappiness:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With your terminal open, let’s see what value swappiness is set at before we decide to adjust swappiness. Enter the following command:

The default is usually 60, at least in the Ubuntu world, and some folks think that’s too aggressive. That value is easy enough to change. But, what I’d suggest doing is adjusting the value temporarily so that you can see what happens when you adjust swappiness. To set the value temporarily, you can just use this command:

Adjust the ’30’ to any number you want between 0 and 100. Both extremes are likely bad, but I’ve used values as low as 10. You could even set it to 0, which should stop the kernel from swapping anything.

Once you find a swappiness value you like, you can make it a permanent change to your system. That’s pretty easy. You just:

Add the following lines of text:

Use your own value if it’s not 30 and save the file. To save a file in nano, press CTRL + X, then Y, and then ENTER.

You can then reboot, or just wait until your next reboot, and the new swappiness value will be used. If you don’t feel like rebooting immediately, just adjust it temporarily and reboot when it’s convenient for you.

Closure:

There you have it, another article! This one has you learning how to adjust swappiness to a value that you can work with. I’d encourage folks to read the linked swap file article to see why I use a swap file even when I have gobs of RAM. If nothing else, using one won’t break anything.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.