Skip to main content
4 votes
Accepted

pset4 header file problem

The headers are read in this order from the file: BITMAPFILEHEADER bf; fread(&bf, sizeof(BITMAPFILEHEADER), 1, inptr); // read infile's BITMAPINFOHEADER BITMAPINFOHEADER bi; fread(&bi, ...
Irene's user avatar
  • 1,687
2 votes
Accepted

PSET4 - Resize, less comfortable - Check50: Image has more bytes than expected

Not related to problem: Move your integer conversion and test for n being in range up, before opening a file, but after test for argc. No need to do any work if you won't resize. Also not related: If ...
Blauelf's user avatar
  • 21k
2 votes
Accepted

pset4 won't resize vertically

There are several issues in the code that need to be addressed. They're affecting both horizontal and vertical scaling when n != 1. Many of the problems are centered around bi.width and bi.height. ...
Cliff B's user avatar
  • 69.3k
2 votes
Accepted

Why is my cs50 resize not working?

There are a couple of issues here. First, the for loop nesting is in the wrong sequence. The outermost loop should be based on the height of the image, but that's the innermost loop. In addition, ...
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

What's wrong with my Resize (Less) code? Pset3

So close, but I think you might be looking in the wrong place. Have you verified that your header values are all correct in the output file????????? Those values control how the image data is ...
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

pset4 resize: setting bfSize and biSizeImage hexadecimal values

Well, that's an unusual way to try and do that. You're writing to the headers in the file! Seems like the hard way to update the headers. Don't you think it would be easy to read the headers into a ...
Cliff B's user avatar
  • 69.3k
1 vote

resize(less) am baffled dont know whats changed pls help

You've clearly looked at the images generated, but have you looked at the raw image data using the xxd tool? It's a lot more revealing because you can see patterns in the raw data! There are a couple ...
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

whats wrong with my code ?why am I not getting the same image?

There are a number of problems that need to be fixed. The code doesn't skip the padding at the end of each line in the input file, so it gets treated as image data. It always goes back to the ...
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

PSET4: free(): invalid next size (fast)

I think I found the answer. The main problem was that I was setting the ppixelIndex variable out of the for loop and I was incrementing it way too much. So when the first iteration for the first row ...
Dement0's user avatar
  • 13
1 vote

pset 4 resize (more confortable) pixel loss logic

The most basic version is copying/dropping pixels. This could be like diff = input_height/2 repeat input_height times diff += output_height read input line skip input padding while ...
Blauelf's user avatar
  • 21k
1 vote

Pset4 resize/less - rewrite (Hint needed)

The error was due to bi.biHeight being negative. So to get it running just changed the declaration of height_in as follows int height_in = abs(bi.biHeight);
Niral Khambhati's user avatar
1 vote
Accepted

Pset 4-- Resize

It all has to do with padding and repositioning with fseek. If the code isn't repositiioning correctly, the code won't be aligned with the beginning of a line of pixels. When that happens the ...
Cliff B's user avatar
  • 69.3k
1 vote
Accepted

PSET 4 (Resize)-- Vertical Scaling

First, I'm assuming that n is the scaling factor. Look carefully at what the code is doing. It starts by creating array[n], an array of RGBTRIPLEs that can hold n pixels. Then, it stores n copies of ...
Cliff B's user avatar
  • 69.3k

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