1

Using my resize on small.bmp and smiley.bmp then with cs50's peek, I get the exact same values as with the staff's solution for BITMAPFILEHEADER and BITMAPINFOHEADER (I tested with different n values).

However, my program fails that check50 tests with a 1x1-pixel BMP when n is 2, 3 and 4 and with a 2x2-pixel BMP when n is 2.

I've tried to get a 1x1 and 2x2 pixel BMP files to test my code on, however the files I've manage to get produce the unsupported file format error.

Where can I get 1x1 and 2x2 pixel BMP files?

Note: I'm on a Mac. I've installed Paintbrush and Seashore to make these BMPs, but they don't seem to be compatible with the resize and I can't figure out how to fix this.

2 Answers 2

4

Your BMP needs to be 24 bits BMP image. I never used Paintbrush and Seashore, but try to find more options as you export your BMP in them.

If you cannot manage to do that, you may use a tool like GIMP. Here are the steps

  1. From the File menu choose New.
  2. Specify the width and the height and click OK.
  3. From the File menu choose Export As.
  4. From the menu near the bottom-right corner choose Window BMP image (.bmp)*

    choose Window BMP image (*.bmp)

  5. Click Export

  6. From the window that appears, choose these settings and hit Export choose these settings
9
  • Dowloaded Gimp made 1x1.bmp as per instructions. File now works. Did the tests, and results: the file info I get when I use my ./resize and the ~cs50/pset4/resize have the same info when I use ~cs50/pset4/peek on them. I'm out of ideas on how to find my mistakes.
    – Touten
    Commented Mar 2, 2015 at 7:33
  • @Touten did you use diff to compare your program's output with the staff's?
    – kzidane
    Commented Mar 2, 2015 at 7:56
  • I hadn't. Just did. Nothing happens. I tested with different files: it says binary files differ. So I know the command works but it says my version of resized file and the ~cs50/pset4/resize version are the same. Now I'm really confused.
    – Touten
    Commented Mar 2, 2015 at 19:36
  • @Touten if it says that the binary files differ, then your program has a problem. Which test cases does your program fail in check50?
    – kzidane
    Commented Mar 2, 2015 at 20:17
  • Sorry I was not clear, my file and the file generated by ~cs50/pset4/resize are the same as far as "diff" is concerned: when I run the command "diff myFile theOtherFile" there is not output. That means they are the same. However, since I havn't used the "diff" command before, I simple used it on two files I know are different to make sure the "diff" command actually works. So the different binary files notification was on the files I already knew where different and just confirmed to me that the "diff" command really works.
    – Touten
    Commented Mar 2, 2015 at 23:51
0

I ran into the same problem and I found a free software package that works well and is much easier to use than GIMP for simple pixel images in BMP format. Check it out at: http://www.qualibyte.com/pixelformer/download.html . Good luck!!

1
  • I'm on a mac and that program is not compatible and I did manage to use gimp with the provided instructions to make a usable 1X1.bmp. Thanks.
    – Touten
    Commented Mar 2, 2015 at 7:36

You must log in to answer this question.

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