0

I figured out how to use peek with resize pset4. But I don't really know if I understand how it works.. The information is written in green, does that mean something?

Also I see argv[1] and argv[2] written with values under them. Which are always the same does that has a meaning?

What I found very weird was the following.. I see this numbers are shown in hexadecimal because the width and the height are given in pixels. But I really would like to understand how these numbers show how many pixels are used? Or am I thinking in a wrong way.. I don't know its just confusing me..

18 LONG biWidth 00000003 00000003

22 LONG biHeight fffffffd fffffffd

The fact that my argv[1] and argv[2] values are always the same.. Does it mean that I am also changing both small.bmp and large.bmp?

Is there anything else I can understand from using peek?

I hope someone of you can clarify this to me.. That would be great!

1

Yes, the green color indicates the values of argv[1] and argv[2] are the same; lines would appear in red otherwise. Peek allows you examine and compare the headers of two images, which you supply as command-line arguments (hence argv[1] and argv[2] being compared).

Consult this part of the pset's specs:

Better yet, if you’d like to compare your outfile’s headers against the staff’s, you might want to execute commands like the below while inside your ~/workspace/pset4/bmp directory. (Think about what each is doing.)

./resize 4 small.bmp student.bmp
~cs50/pset4/resize 4 small.bmp staff.bmp 
~cs50/pset4/peek student.bmp staff.bmp
  1. Step one is to resize small.bmp by a factor of 4 to create student.bmp by using your own code.
  2. Step two is to resize small.bmp by a factor of 4 to create staff.bmp by using the staff's solution.
  3. Step three is to use peek on the headers of your resized student.bmp and the staff's resized staff.bmp.

This will allow you to compare the headers of student.bmp (argv[1]) and staff.bmp (argv[2]) as a way of checking that your headers are what they should be.

I hope this clarifies the function and purpose of peek for you!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .