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, ...
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 ...
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. ...
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, ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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);
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
pset4resize × 25pset4 × 15
resize × 11
pset3resize × 3
pset3 × 2
cs50x × 2
resize-less × 2
c × 1
pointers × 1
pset4recover × 1
cs50x2017 × 1
malloc × 1
less × 1
gradebook × 1
arrays × 1
free × 1
runtimeerror × 1
vertical-resizing × 1
file-pointer × 1
pixels × 1
logic × 1
score × 1