Skip to main content
8 votes
Accepted

pset4 resize, invalid or unsupported image format

The immediate problem lies with your header structures. You have created bi_new and modified two of it's fields, but you forgot to copy the contents of bi to bi_new, so all of the unmodified fields ...
Cliff B's user avatar
  • 69.2k
2 votes
Accepted

Having trouble with PSet4 resize problem

Two issues I think I see are: 1) You change the value of BiWidth to BiWidth = BiWidth * scale (and same for BiHeight) for use in changing the header values but then you use those updated values in the ...
Hoya Coder's user avatar
2 votes
Accepted

nothing can be done for whodunit. Even though I have my bmp.h file still it shows me that the file doesn't exist. help me out

You may have the file, but it isn't in the same directory as your source code file and/or the directory where you are executing your make command. You must be in the same directory on the command line ...
Cliff B's user avatar
  • 69.2k
2 votes
Accepted

Odd IDE behavior during pset4

The problem lies early in your code: if (argc != 4 || !isdigit(argv[1])) The isdigit() function is designed to check whether a single character is a digit, not a string. This code is trying to ...
Cliff B's user avatar
  • 69.2k
2 votes

2019 CS50 PSet 4 Filter Less

Have you watched the "Walkthrough" videos yet? It looks like there's only one video, but there are actually several (just kind of hidden because they will play one after another, and you can select ...
azb1297's user avatar
  • 63
1 vote
Accepted

PSET3 Resize (more comfortable), resizing f > 1 correctly, but pixels are different colors. Does not work when f < 1

Actually, no, the code doesn't work correctly at all. First, the header data is incorrect. Two fields are not calculated correctly. Second, even at resize of 1, the image output is incorrect. ...
Cliff B's user avatar
  • 69.2k
1 vote
Accepted

CS50 pset3 i want to resize this image, code is working for some and not for others? Can anyone tell me whats the problem?

The problems revolve around how the pointer is moved at the end of each line in the input file and how padding is added to the output file. There are two issues. First, the output file padding. It ...
Cliff B's user avatar
  • 69.2k
1 vote

determine padding for scanlines in copy.c

It's not needed for a padding of 1, 2, or 3 bytes. But imagine what happened if bi.biWidth were a multiple of 4. bi.biWidth * sizeof(RGBTRIPLE) would be a multiple of 4. (bi.biWidth * sizeof(...
Blauelf's user avatar
  • 21k
1 vote
Accepted

Problem interpreting BMP file structure

Bytes inside the fields are the other way around. Citing Wikipedia on BMP format: All of the integer values are stored in little-endian format (i.e. least-significant byte first).
Blauelf's user avatar
  • 21k
1 vote

Pset 4 Resize makes a very colorful picture (not green!)--padding problem?

You change bi.biWidth and bi.biHeight to new scale using bi.biWidth = bi.biWidth * enlarge; bi.biHeight = bi.biHeight * enlarge; and then use code that relies on the values to represent the ...
Blauelf's user avatar
  • 21k
1 vote

can't pass check50

There is definitely an issue with your code. You should first test with scale factor of 1, make sure the headers are right, then check the image data, using the peek and xxd tools. Once those are ...
Cliff B's user avatar
  • 69.2k
1 vote
Accepted

pset4 resize: how to copy a row

"Everyone's looking for a zebra. I see the injured horse." All of the file reads and writes are using the outptr output file pointer. The only reference to the input file pointer inptr is the fclose ...
Cliff B's user avatar
  • 69.2k
1 vote
Accepted

pset4 malloc() approach. Help with size of buffer

It has nothing to do with the malloc call itself. The problem lies in what you think you are checking. Look at the following: RGBTRIPLE* row = ... int sizeRow = sizeof(row); row is declared as a ...
Cliff B's user avatar
  • 69.2k

Only top scored, non community-wiki answers of a minimum length are eligible