Instructor: How to open an image file?
I know a lot of people, a lot of my students have asked me
that GV could open a regular file, a text file,
using Vi, cat, more, head
or any other ways to open,
it's easy or even Vi,
the file to open a text file.
Now the question that came up was
how we could open an image file using the command line?
Well first of all, if you are in a GUI environment,
you could simply double click on that image file
and it will open up.
But if you do not want to use the double-clicking thing,
or you want it to run a command to open up a file,
an image file,
and there is a way to do that.
So image file formats are standardized means
of organizing and storing digital images.
Image files are composed of digital data
in one of these formats that can be rasterized
for use on a computer display or printer.
An image file format may store data in uncompressed,
compressed, or vector format.
This definition is straight out of Wikipedia.
I just wanna quickly go over it.
What we will learn in this lesson
is how can we install a program
that will allow us to open an image file
and command syntax to open that image file in GUI?
Alright, so let's go into our Linux machine.
I have my Linux machine right here.
Now if you have an image, you could,
on the GUI, you could just simply double click
and it will open up.
But the question right here we have is we want
to run a command to open up an image.
But please do remember if you are getting
into your Linux machine through SSH or through PuTTY,
and then you try this, it will not work
because images, GUIs, and stuff like that do not work
on Linux terminals.
So for us to try out how we could open it,
we have to actually first get an image into our system.
So I have my Firefox open,
I went to google.com
and I actually...
clicked on Google.
I typed linux.
I went to images
and it gave me all bunch of Linux-related images.
Let's pick any one that you like.
I will pick this penguin,
right click on this image,
and click on Save Image As.
This will ask you where do you want to save this image?
So pick Desktop because this is your desktop
where you will be saving your image.
So scroll down and click Save.
Now you could go back up.
You could close this Firefox
because our image is downloaded,
as you could see it is right here.
And if you wanted to open up this image in GUI,
all you do is you double click
and it will open up the image in your Linux.
Perfect.
Now again, going back to my question is,
now how can we open that using command?
So which territory I am in?
I am in home/iafzal.
If I go to my desktop and do ls minus l,
I do see the file is there, which is 1200pTx,
which is the same name as this.
If I do cat on it,
then what happened?
Oops, it doesn't know what that file is or how to open it.
Then which other command that I could run
to open that image?
Well for that, you have to install a program called Image.
So what this document says is basically,
you have to become root.
So let's go become root
and then you have to run the command,
"yum install ImageMagick",
that's a package name actually.
So let's clear the screen
and before we do the yum install,
let's make sure we could get out to the internet.
So to confirm that we could get out to the internet,
you could simply ping www.google.com
and we are getting the reply back.
Perfect.
Now you could go ahead
and do yum install ImageMagick minus y.
So it is looking for the package that we want to download.
It is looking for dependencies.
Okay, it asks that their package,
installed package is one size is 9.1 M.
It went pretty fast because we have given the option to...
given the option of Y,
which is y for yes to go ahead and install it.
Now let's confirm if that image rpm has been installed.
Rpm grep,
so there you go.
ImageMagick,
this is the rpm.
This is the program that allows you to open your image file.
Now you have to run the command,
which is display space image of the file,
the file name actually.
Alright, so before we do that,
let's get into our directory where that image is located.
So that is in our home, iafzal directory.
When you do ls minus l,
you will see it has all the directories and files,
but we had downloaded that image file in desktop folder.
Then do ls minus l
and you will see our file is there.
Now you could run the command display,
the file name, and hit enter
and this will open up your image file.
That's how it works
if you wanted to use this command to open up the image file.
But anyway, I do wanna let you know,
in corporate world we do not have too much application
or it's used in a real world.
We don't really use this command or this package.
But anyway, I listen to my students as always
and I have included this lesson.
So this way, if someone wants to find out how
to open an image file to the command line,
they would know how to do that.
Alright, good luck.