3 votes
Accepted

PEST4 Resize (less comfortable)

In the headers, you forget to put the new biWidth and biHeight in the BitmapInfoHeader of the new file. You do compute the new values, but you don't write them into the headers. And to quote Cliff B:...
Peter Pesch's user avatar
2 votes
Accepted

Could someone please tell me where I'm going wrong here in resize-less(pset4)?

There are two major issue. First, the code is using biWidth and biHeight for the output file to control reading from the input file. Second, there's no actual code to handle vertical scaling. ...
Cliff B's user avatar
  • 68.7k
2 votes
Accepted

Pset3 - Resize (less confortable)

Your output file is too large, larger than the header claims. Use input height, not output height for the outermost for loop. Not sure this can explain the problem you describe, especially those ...
Blauelf's user avatar
  • 20.9k
2 votes

CS50 Resize(less comfortable) I can't create OUTFILE

As you know arrays start with index 0. it means name of outfile should be char *outfile = argv[3]; , not argv[4].
Sergei Iakimchuk's user avatar
2 votes
Accepted

CS50 - Pset3 - Resize (Less)

I would wager that you looked at the images but not at the raw data in the files. Since the header is correct, it tells any bmp viewer to display the amount of data that should be in the image, but if ...
Cliff B's user avatar
  • 68.7k
1 vote
Accepted

pset 3resize (less) how to store RGBTRIPLES in array

It's actually a structure, or a struct that is defined in the bmp.h file: /** * RGBTRIPLE * * This structure describes a color consisting of relative intensities of * red, green, and blue. * * ...
Cliff B's user avatar
  • 68.7k
1 vote
Accepted

Code divides image

Let's see the very first switch being the first pixel on the left and the last pixel on the right. In your code: image [i][j] = image [i][(width -1) - j]; you copied the last pixel in the first ...
Tritum's user avatar
  • 1,571
1 vote
Accepted

PLS help, not working

:( resizes small.bmp correctly when n is 2 expected 0x6, not 0x3 in header field biWidth This tells you there's the wrong value in new_bi.biWidth when you write it to the output file. If you look ...
Blauelf's user avatar
  • 20.9k
1 vote
Accepted

writing pixels n times to array

I assume you declared RGBTRIPLE scanline[newwidth];, so that all the pixels actually fit in. Allocating on heap like RGBTRIPLE *scanline = malloc(newwidth * sizeof(RGBTRIPLE)); would work too, but ...
Blauelf's user avatar
  • 20.9k
1 vote
Accepted

Pset3 Resize (less) - working fine except on small.bmp

Your problem is where RGBTRIPLE array[orgBiWidth]; is declared. It's declared within the loop, so when the current iteration is over, this memory is marked unused, and part of it will be reused before ...
Blauelf's user avatar
  • 20.9k
1 vote

Problem with CS50 Pset3 Resize Less

You've declared a new header struct, but you never gave it any values // write outfile's BITMAPFILEHEADER BITMAPFILEHEADER outfile_bf; fwrite(&outfile_bf, sizeof(outfile_bf), 1, outptr); ...
curiouskiwi's user avatar
  • 18.6k
1 vote
Accepted

Problem with CS50 Pset3 Resize Less

Hmmm..... After the code creates the output file headers, do you think it would be useful to load/copy the values from the input file headers into the output file headers? // write outfile's ...
Cliff B's user avatar
  • 68.7k
1 vote
Accepted

pset3 resize less

Have you looked at the actual hex data of the file instead of the image? When looking at the image, the header data (assuming it's correct) will only allow the display of the specified amount of data ...
Cliff B's user avatar
  • 68.7k
1 vote

cs50 pset3 resize less

Would be nice if you could describe the problem next time. Like does the programme crash? Is there a header mismatch (use cs50's peek as described in the "Testing" chapter)? Is the file size wrong? ...
Blauelf's user avatar
  • 20.9k
1 vote

PSET3- Resize (Less)- Problem resizing horizontally

The calculation of the headings is clearly incorrect, as shown in its image, one of the difficulties of this set is that it needs extensive documentation and a deep understanding of how a BMP works. ...
MARS's user avatar
  • 5,169
1 vote
Accepted

CS50 - Pset3 - Resize (Less) - Wrong Bitmap Size

The code will work when the scaling factor is 1, but not otherwise. The problem is straightforward. The code calculates the new biHeight and biWidth values, but it doesn't plug them back into the ...
Cliff B's user avatar
  • 68.7k
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
  • 68.7k
1 vote
Accepted

pset3 Resize - Invalid or unsupported Image Format

Have you actually looked at the raw hex data contained in the program's output files? Notice anything interesting? Where is the bmp signature that's supposed to be in the first 2 bytes? Next ...
Cliff B's user avatar
  • 68.7k
1 vote
Accepted

PSET3 Resize (Less) - works in debug50 but segmentation error when executing

You have just learned an important lesson. Seg faults can be muted by debug environments. When this happens, you need to isolate the offending statement using printf statements to see how far ...
Cliff B's user avatar
  • 68.7k
1 vote
Accepted

Is scan line not moving to the next line? I'm badly stuck. Please advice

Several issues here. First, look at the code that expands the line horizontally: for (j = 0; j < biSmall.biWidth; j++) { // read RGB triple from infile ...
Cliff B's user avatar
  • 68.7k
1 vote
Accepted

Where am I going wrong with this resize?

For each input line, you currently read bi.biWidth * scale_factor pixels from input. Obviously, the input line does not have that many (unless the factor is 1). One approach is to read the pixels to ...
Blauelf's user avatar
  • 20.9k
1 vote
Accepted

Rewrite method in Resize (less) is printing wrong large.bmp

First, there are errors in calculating header data. That should be easy to fix. The design logic for vertical scaling is totally flawed. Understand that images are not stored in two dimensions. The ...
Cliff B's user avatar
  • 68.7k
1 vote
Accepted

[Pset 4 resize (less comfortable)]: problem with getting the correct RBG output

Actually, you don't get the correct image size. The output image data is several times larger than it should be. The intent of the code posted above is to read in a pixel (an RGBTRIPLE), copy it to a ...
Cliff B's user avatar
  • 68.7k
1 vote
Accepted

pset4 resize(less) vertical

Looks like too many loops. Why is there an outer loop that processed the entire input file n times? Most of the pieces are there, but reprocessing the entire file more than once won't accomplish ...
Cliff B's user avatar
  • 68.7k
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
  • 68.7k
1 vote
Accepted

Resize less confortable : issue writing new file header info and printing new image

From one line of input data, you need to write coef lines of output data. Either remember the line using an array and write it multiple times, or jump back (using fseek) and re-read the input line.
Blauelf's user avatar
  • 20.9k
1 vote
Accepted

pset 4 resize (less)

So, I see that it calculates the padding for the input file. Where is the padding calculation for the output file? They are not necessarily the same, especially if the scaling factor != 1. Also, ...
Cliff B's user avatar
  • 68.7k
1 vote

Resize less comfortable; still stuck; cannot understand f(seek)

You have to check your command line arguments. You take the third argument as the resize factor and as the infile name.
Noah Haasis's user avatar
1 vote
Accepted

Pset4 resize less comfortable; doesn;t resize; please help

1st problem: You have skip over padding (when reading from the input file) within the third for loop, the same loop you are using to horizontally multiply the pixels. We don't skip over padding for ...
Jonathan 's user avatar

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