1 00:00:00,000 --> 00:00:03,629 How to open an image file? I know a lot 2 00:00:03,629 --> 00:00:05,309 of people, a lot of my students have 3 00:00:05,339 --> 00:00:08,489 asked me that we could open a regular 4 00:00:08,489 --> 00:00:12,479 file, a txt file using vi, cat, more, head, 5 00:00:12,749 --> 00:00:15,809 or any other ways to open, it's easy or 6 00:00:15,809 --> 00:00:18,419 even vi the file to open a text file. 7 00:00:19,649 --> 00:00:22,409 Now the question that came up was how we 8 00:00:22,409 --> 00:00:25,739 could open an image file using the 9 00:00:25,739 --> 00:00:28,799 command line? Well, first of all, if you 10 00:00:28,799 --> 00:00:30,899 are in a GUI environment, you could 11 00:00:30,899 --> 00:00:33,389 simply double click on that image file 12 00:00:33,418 --> 00:00:35,999 and it will open up. But if you do not 13 00:00:35,999 --> 00:00:38,189 want to use the double clicking thing, 14 00:00:38,459 --> 00:00:40,499 and you want to run a 15 00:00:40,499 --> 00:00:42,749 command to open up a file, an image 16 00:00:42,749 --> 00:00:46,349 file, then there is a way to do that. So 17 00:00:46,379 --> 00:00:49,439 image file formats are standarized means 18 00:00:49,499 --> 00:00:51,809 of organizing and storing digital 19 00:00:51,809 --> 00:00:54,509 images. Image files are composed of 20 00:00:54,509 --> 00:00:57,929 digital data in one of these formats 21 00:00:57,929 --> 00:01:01,019 that can be rasterized for use on a 22 00:01:01,019 --> 00:01:03,509 computer display or printer. An image 23 00:01:03,509 --> 00:01:05,638 file format may store data in 24 00:01:05,638 --> 00:01:07,799 uncompressed, compressed, or vector 25 00:01:07,799 --> 00:01:10,649 format. This definition is straight out 26 00:01:10,649 --> 00:01:13,799 of Wikipedia. I just want to quickly go 27 00:01:13,799 --> 00:01:16,649 over it. What we will learn in this 28 00:01:16,649 --> 00:01:20,399 lesson is how can we install a program 29 00:01:20,579 --> 00:01:23,459 that will allow us to open an image file 30 00:01:24,119 --> 00:01:27,659 and command syntax to open that image 31 00:01:27,659 --> 00:01:30,869 file in GUI. Alright, so let's go into 32 00:01:30,899 --> 00:01:33,509 our Linux machine. I have my Linux 33 00:01:33,509 --> 00:01:37,889 machine right here. Now, if you have an 34 00:01:37,919 --> 00:01:40,199 image you could undergo, you could just 35 00:01:40,229 --> 00:01:42,329 simply double click and it will open up. 36 00:01:42,779 --> 00:01:45,989 But the question right here we have is 37 00:01:45,989 --> 00:01:47,879 we want to run a command to open up a 38 00:01:47,879 --> 00:01:50,819 image. But please do remember, if 39 00:01:50,819 --> 00:01:54,299 you are getting into your Linux machine 40 00:01:54,299 --> 00:01:56,879 through SSH or through PuTTY, and then 41 00:01:56,879 --> 00:01:59,519 you try this, it will not work because 42 00:01:59,549 --> 00:02:02,549 images, GUIs, and stuff like that do not 43 00:02:02,549 --> 00:02:08,579 work on Linux terminals. So for us to 44 00:02:08,579 --> 00:02:10,649 try out how we could open it, we have to 45 00:02:10,649 --> 00:02:12,959 actually first get an image into our 46 00:02:12,959 --> 00:02:16,919 system. So I have my Firefox open. I 47 00:02:16,919 --> 00:02:21,179 went to google.com. And I actually 48 00:02:21,179 --> 00:02:24,809 [No audio] 49 00:02:24,809 --> 00:02:29,399 clicked on Google, I typed Linux, I went 50 00:02:29,399 --> 00:02:32,039 to images, and it gave me all bunch of 51 00:02:32,039 --> 00:02:34,349 Linux related images. Let's pick any one 52 00:02:34,349 --> 00:02:36,869 that you like, I will pick this penguin. 53 00:02:37,739 --> 00:02:40,109 Right click on this image and click on 54 00:02:40,109 --> 00:02:44,309 Save Image As, this will ask you where do 55 00:02:44,309 --> 00:02:47,069 you want to save this image. So pick 56 00:02:47,189 --> 00:02:49,589 Desktop because this is your Desktop 57 00:02:49,589 --> 00:02:52,619 where you will be saving your image. So 58 00:02:52,859 --> 00:02:56,999 scroll down and click Save. Now you 59 00:02:56,999 --> 00:02:59,429 could go back up, you could close this 60 00:02:59,459 --> 00:03:03,269 Firefox because our image is downloaded. 61 00:03:03,299 --> 00:03:06,029 As you can see it is right here. And if 62 00:03:06,029 --> 00:03:08,279 you want to open up this image in GUI, 63 00:03:08,309 --> 00:03:11,069 all you do is you double click and it 64 00:03:11,069 --> 00:03:14,609 will open up the image in your Linux, 65 00:03:14,609 --> 00:03:17,189 perfect. Now, again going back to my 66 00:03:17,189 --> 00:03:19,589 question is, now how can we open that 67 00:03:20,099 --> 00:03:22,649 using command? So which directory I am in? 68 00:03:22,679 --> 00:03:25,649 I'm in home/iafzal. If I go to my 69 00:03:25,649 --> 00:03:28,949 Desktop, and do ls -l, I do see the 70 00:03:28,949 --> 00:03:31,469 file is there which is 1200px which is 71 00:03:31,469 --> 00:03:34,259 the same name as this. If I do cat on it, 72 00:03:34,259 --> 00:03:36,149 [No audio] 73 00:03:36,149 --> 00:03:38,459 that what will happen? Oops, it doesn't know 74 00:03:38,459 --> 00:03:41,339 what that file is or how to open it. 75 00:03:41,879 --> 00:03:44,369 Then what which other command that I 76 00:03:44,369 --> 00:03:46,829 could run to open that image? Well for 77 00:03:46,829 --> 00:03:48,689 that you have to install a program 78 00:03:48,689 --> 00:03:52,559 called image. So what this document says 79 00:03:52,589 --> 00:03:57,899 is basically you have to become root. So 80 00:03:57,899 --> 00:04:02,429 let's go become root, and then you have 81 00:04:02,429 --> 00:04:05,593 to run the command yum install ImageMagick. 82 00:04:05,593 --> 00:04:07,199 That's a package name actually. 83 00:04:07,649 --> 00:04:10,679 So let's clear the screen, and before we 84 00:04:10,679 --> 00:04:12,509 do the yum install, let's make sure we 85 00:04:12,509 --> 00:04:15,269 could get out to the internet. So to 86 00:04:15,269 --> 00:04:17,009 confirm that we could get out to the 87 00:04:17,009 --> 00:04:20,879 internet you could simply ping www.google.com, 88 00:04:20,879 --> 00:04:24,298 and we are getting the reply back, perfect. Now you could go 89 00:04:24,298 --> 00:04:30,749 ahead and do yum install ImageMagick -y. 90 00:04:30,749 --> 00:04:40,740 [No audio] 91 00:04:40,740 --> 00:04:43,080 So it is looking for the package that we 92 00:04:43,080 --> 00:04:45,810 want want to download it is looking for 93 00:04:46,440 --> 00:04:49,500 dependencies. Okay, it asked that the 94 00:04:49,500 --> 00:04:53,490 package install packages size is 9.1 95 00:04:53,490 --> 00:04:56,700 meg, it went pretty fast, because we have 96 00:04:56,700 --> 00:05:01,500 given the option to, given the option 97 00:05:01,500 --> 00:05:04,920 of y, which is -y for yes to 98 00:05:04,920 --> 00:05:07,380 go ahead and install it. Now let's 99 00:05:07,410 --> 00:05:12,120 confirm if that image, rpm has been 100 00:05:12,120 --> 00:05:16,110 installed. rpm -qa | grep ImageM, so there you go. 101 00:05:16,680 --> 00:05:19,440 ImageMagick, this is the rpm, this is the 102 00:05:19,440 --> 00:05:22,260 program that allows you to open your 103 00:05:22,260 --> 00:05:26,280 image file. Now you 104 00:05:26,280 --> 00:05:28,290 have to run the command which is 105 00:05:28,290 --> 00:05:30,630 displays base image of the file, the 106 00:05:30,630 --> 00:05:33,060 file name actually. Alright, so before 107 00:05:33,060 --> 00:05:36,360 we do that, let's get into our directory 108 00:05:36,360 --> 00:05:39,540 where that image is located. So that is 109 00:05:39,570 --> 00:05:42,900 in our /home/iafzal directory. 110 00:05:43,410 --> 00:05:46,140 When you do ls -l, you will see it 111 00:05:46,140 --> 00:05:48,300 has all the directories and files. But 112 00:05:48,330 --> 00:05:51,270 we had downloaded that image file in 113 00:05:51,300 --> 00:05:55,440 Desktop folder, then do ls -l, and 114 00:05:55,440 --> 00:05:58,650 you will see our file is there. Now you 115 00:05:58,650 --> 00:06:02,160 can run the command display, the file 116 00:06:02,160 --> 00:06:06,090 name, and hit enter, and this will open 117 00:06:06,120 --> 00:06:10,440 up your image file. That's how it works 118 00:06:10,470 --> 00:06:13,140 if you wanted to use this command to 119 00:06:13,140 --> 00:06:15,750 open up the image file. But anyway, I do 120 00:06:15,750 --> 00:06:17,700 want to let you know in corporate world, 121 00:06:17,700 --> 00:06:19,920 we do not have too much application or 122 00:06:19,920 --> 00:06:23,730 it's used in a real world. We 123 00:06:23,730 --> 00:06:25,770 don't really use this command or this 124 00:06:25,770 --> 00:06:29,190 package. But anyway, I listen to my 125 00:06:29,190 --> 00:06:32,310 students as always, and I have included 126 00:06:32,310 --> 00:06:35,340 this lesson. So this way if someone 127 00:06:35,340 --> 00:06:38,010 wants to find out how to open an image 128 00:06:38,010 --> 00:06:40,470 file through the command line, they will know 129 00:06:40,470 --> 00:06:42,810 how to do that. All right, good luck. 130 00:06:42,810 --> 00:06:44,074 [No audio]