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…
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:
sudo apt install imagemagick
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:
mogrify -format png *.jpg
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:
convert <file_name>.jpg <new_file_name>.png
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.
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.
Today we'll cover one way to enable or disable your network interface in the Linux…
Today's exercise is a nice and simple exercise where we check your NIC speed in…
Have you ever wanted to easily monitor your wireless connection? Well, now you can learn…
I think I've covered this before with the ls command but this time we'll count…
Today we'll be learning about a basic Linux command that's known as 'uname' and it…
If you've used hardinfo in the past, it may interest you to know that hardinfo…