Difference between revisions of "CSC220 Lab 2 2010"

From dftwiki3
Jump to: navigation, search
(Part 1)
(Part 1)
Line 13: Line 13:
 
* use '''wget''' (see [[CSC220 Lab 1 2010|Lab 1]]) to retrieve all three images into your account.  Use a for-loop!  Something like this is a good start:
 
* use '''wget''' (see [[CSC220 Lab 1 2010|Lab 1]]) to retrieve all three images into your account.  Use a for-loop!  Something like this is a good start:
  
  for i in a b c ; do
+
        for i in a b c ; do
    echo $i
+
          echo $i
    echo 220${i}
+
          echo 220${i}
  done
+
        done
  
 
* verify that you got the images by displaying them with the '''display''' command (also part of imagemagick).  Example:
 
* verify that you got the images by displaying them with the '''display''' command (also part of imagemagick).  Example:
  
  display 220a.jpg
+
      display 220a.jpg
  
 
* Can you tell what these three pictures have in common?
 
* Can you tell what these three pictures have in common?
Line 26: Line 26:
 
* Overlay the 220 road sign image on top of the car:
 
* Overlay the 220 road sign image on top of the car:
  
composite -geometry +10+10 220a.jpg 220c.jpg 220ac.jpg
+
      composite -geometry +10+10 220a.jpg 220c.jpg 220ac.jpg
  
 
* Display 220ac.jpg to see the result.  The +10+10 part of the command specify that the top-left corner of the first image (road sign) should be 10 pixels left and 10 pixels down from the second image (car).  The result is a new file called 220ac.jpg.
 
* Display 220ac.jpg to see the result.  The +10+10 part of the command specify that the top-left corner of the first image (road sign) should be 10 pixels left and 10 pixels down from the second image (car).  The result is a new file called 220ac.jpg.
  
 
* Using the same approach overlay image 220b.jpg on 220ac.jpg, and offset it by 850 pixels left, and 10 down (or pick your own coordinates; this is not important for this lab).
 
* Using the same approach overlay image 220b.jpg on 220ac.jpg, and offset it by 850 pixels left, and 10 down (or pick your own coordinates; this is not important for this lab).

Revision as of 10:46, 14 September 2010

Page under construction!
UnderConstruction.jpg

Creating Images

  • This part of the lab uses a very nice and powerful program that is often bundled in the various Linux distribution (Fedora, Ubuntu, Suse, etc): ImageMagick. It is a collection of different programs that allow for very clever and powerful image manipulations.

Part 1

  • There are 3 images in the 220a public_html folder, called 220a.jpg, 220b.jpg, and 220c.jpg. You can see them by opening this URL: http://cs.smith.edu/~220a/
  • use wget (see Lab 1) to retrieve all three images into your account. Use a for-loop! Something like this is a good start:
       for i in a b c ; do
          echo $i
          echo 220${i}
       done
  • verify that you got the images by displaying them with the display command (also part of imagemagick). Example:
      display 220a.jpg
  • Can you tell what these three pictures have in common?
  • Overlay the 220 road sign image on top of the car:
      composite -geometry +10+10 220a.jpg 220c.jpg 220ac.jpg
  • Display 220ac.jpg to see the result. The +10+10 part of the command specify that the top-left corner of the first image (road sign) should be 10 pixels left and 10 pixels down from the second image (car). The result is a new file called 220ac.jpg.
  • Using the same approach overlay image 220b.jpg on 220ac.jpg, and offset it by 850 pixels left, and 10 down (or pick your own coordinates; this is not important for this lab).