Questions tagged [resize]

resize.c, one of the assignments in Problem Set 4, will require you to scale a bitmap image by a certain factor (making it 2, 3, or n times as large).

Filter by
Sorted by
Tagged with
0
votes
1answer
161 views

pset5 resize correct, cs50 check indicates error and prints two "TODO's"

"When I run my implementation of resize.c in check50, there are two "TODO's" in red at the bottom of some sections. Does anyone know what this means? (My programs output is identical to the staff's ...
-1
votes
1answer
160 views

resizing problem

check50 shows that i cant resize 1x1px image by 2 and 3, others are fine and i don't know why....can anyone give me some hints. thanks. My headers are fine as i checked... // read infile's ...
0
votes
1answer
663 views

Not sure why resize.c isn't working

resize.c compiles and runs, but produces an image with a lot of black space. A fresh set of eyes on my code is welcome to see where I have gone wrong. I assume it has to do with padding but I can't ...
0
votes
0answers
154 views

Unable to solve resize.c

Hello guys I am stuck at pset-5 resize.c problem. Here is what i have done: 1) For updating header, in width and height, ave multiplied them by n and for Image size, subtracted the padding of input ...
0
votes
2answers
371 views

Getting the vertical scaling right in pset5

I've got resize working to the point where it resizes horizontally, but not vertically. Here is the code: // iterate over infile's scanlines for (int i = 0, biHeight = abs(old_biHeight); i < ...
1
vote
1answer
201 views

Is my pset5 resize working or not?

When I try to run my ./resize 4 small.bmp large.bmp I get this: jharvard@appliance (~/Dropbox/pset5/bmp): ./resize 4 small.bmp large.bmp Could not open 4. Check50 seems to say that I have extraneous ...
-1
votes
1answer
337 views

Problem with resize

I'm with the pset5 and my code doesn't work and I don't know why. Can somebody help me? Here is my code: //resize headers BITMAPFILEHEADER bfNew; BITMAPINFOHEADER biNew; biNew.biWidth = bi.biWidth * ...
1
vote
1answer
564 views

How is biSizeImage calculated for a 1x1 BMP with n = 1?

I'm so close, but my program does not pass check50 because it doesn't resize a 1x1 BMP correctly when n is 1, 2, 3, 5 (i.e., when it needs padding). When I use peek to compare with staff for 1x1 and ...
1
vote
1answer
192 views

Resizing small.bmp with n=4 gives an image with a black rectangle on the bottom left corner

When I try my resize program on small.bmp and enter 4 as n, it gives me a 12x12 picture that is all green, but instead of having the white little square in the middle it has a black rectangle on the ...
0
votes
0answers
166 views

Resize vertically not working. Help!

Okay, my image is coming out a bit shifted and with two dark spots. please help me pinpoint whats going wrong // iterate over infile's scanlines for (int i = 0, biHeight = abs(bi_o.biHeight); i &...
1
vote
1answer
1k views

check50 reports resize as incorrect for 1, 2, 3, 5 for seemingly correct code

is the check50 report for my code : jharvard@appliance (~/Dropbox/pset5/bmp): check50 2014/x/pset5/resize bmp.h resize.c :) resize.c and bmp.h exist :) resize.c compiles :( doesn't resize 1x1-pixel ...
0
votes
1answer
437 views

resize vertically is not working properly

i take the re-copy approach guys and badly stuck in that problem .. everything my code is fine just writing pixel is wrong somewhere. i'm posting my writing snippet of my resize please give me some ...
0
votes
1answer
437 views

Wrong output resize

Update: I changed everything, what was mentioned, however it is not working yet. Maybe my assumption was wrong that the headers are updating correctly, when i run peek, i see green numbers... Has ...
0
votes
1answer
528 views

"Unsupported file format" error when checking the format of BMP files

pset5 is the first pset so far that I've really struggled to understand. I've written the code, but I can't test the algorithms because everytime I run it I get "Unsupported file format" // ensure ...
0
votes
2answers
786 views

resize vertically doesn't work

First of all I know there are a lot of other questions like this but I have looked at all of them. They have helped a lot but I am still stuck. I can't see anything logically wrong with my code, but ...
0
votes
1answer
556 views

Rewrite method in resize.c

I am currently trying to conceptualize the idea of creating the vertical nth copy for resize.c but I don't grasp how the file position indicator can tell when there is a new line. How do I tell C to ...
0
votes
1answer
1k views

Updating header info in resize

I know I have to do this: //resize headers biWidth = biWidth * n biHeight = biHeight * n biSizeImage = (biHeight*3) * (biWidth*3) + padding bfSize = biSizeImage + 54 But I don't know ...
0
votes
1answer
710 views

How to use fseek in resize and what's wrong with my code?

The resize assignment has had me spinning in circles for the past few weeks. Could someone give me an example of how to use fseek and point out the logic errors in my code? for (int i = 0, biHeight = ...
0
votes
1answer
665 views

Resize.c fails the check "resizes 2x2-pixel BMP to 4x4 correctly when n is 2"

Check50 is failing my code and I am out of options to troubleshoot this. Any help from the community is greatly appreciated. I have compared different resizing factors for small.bmp and smiley.bmp ...
0
votes
1answer
477 views

PSET5: Trouble with CHECK50 and resize.c. Stuck with this problem [duplicate]

While submitting resize.c to check50 in pset5, I get the following results: check50 2014/x/pset5/resize bmp.h resize.c :) resize.c and bmp.h exist :) resize.c compiles :) doesn't resize 1x1-pixel ...
0
votes
1answer
168 views

pset5 resize file io fread

Among the recommended reading list for this pset was this page (http://www.cprogramming.com/tutorial/cfileio.html), which indicates that when using fopen specifically for reading or writing in binary, ...
0
votes
2answers
676 views

pset5 resize re-copy method

I'm trying to resize bmp files in Pset 5 using the re-copy method. However, it seems as though I'm calculating the headers wrongly and I'm also not implementing the for loop where I repeat the ...
0
votes
1answer
212 views

Conceptualising resizing in pset5

I've just solved the resizing part of pset5 without completely understanding what is happening during the reading of the infile and writing of the outfile bit. To clarify my question, here is my code ...
1
vote
1answer
284 views

check50 has 2 TODO's in red for resize.c

When I run my implementation of resize.c in check50, there are two "TODO's" in red at the bottom of some sections. Does anyone know what this means? (My programs output is identical to the staff's ...
0
votes
1answer
181 views

pset5 resize, not enough memory to load bmp

Resize is compiling but the outfile bmp doesn't open. It gives me an error "Not enough memory to load bmp". Does anybody have any idea why that might be happening? Where am I going wrong? Here's my ...
0
votes
1answer
294 views

Serious problems with pset5 resize - alterations to headers [closed]

I'm really struggling with this pset, and resize especially - I have gone through the code, but I don't know what I am missing. I could really use someone to take a look at the code and point me in ...
1
vote
1answer
510 views

adding padding into resize

I know my paddingOld & paddingNew values are correct. I also know all my header info is correct (checked student vs staff) check 50 passes the cases that do not need padding, but fails the ones ...
0
votes
0answers
182 views

check50 fails my pset 5 resize.c even though output is identical to staff's implementation

I ran diff with the bmp file outputted by my resize program and the same bmp file outputted by the staff's implementation, and it says that the two files are identical; but check50 says it doesn't ...
2
votes
2answers
4k views

Pset 5 - Resize

I'm having problems with the header manipulation. My code seems to factor well images but it doesn't calculate well bi.biSizeImage and bf.bfSize. This is what I've done: // read infile's ...
0
votes
1answer
559 views

How to implement re-copy method for resize?

I have been through my code a few times aloud and on paper and have hit a brick wall. I'd rather get a hold on the re-copy method before bottling it and trying the re-write method. // iterate over ...
0
votes
1answer
293 views

pset5 resize segmentation fault?

I am getting a segmentation fault when I run this program, and am fairly sure that the problem is in the third for loop, where I try to copy the bytes from *pixel to *line, duplicating each byte '...
1
vote
1answer
2k views

resize: having header problems

My program compiles and everything, but when I try to open up the image it says the image has "bogus header files". I'm not sure what I'm doing wrong. Here's some of my code: // read infile's ...
1
vote
1answer
247 views

what is happening in pset5 resize hacker edition?

I implemented the staff's solution to compress a bmp by a factor say 0.5 and compared the compressed version with the original bmp using xxd command. I expected it copy just half of rgb triples from ...
0
votes
1answer
397 views

How does the "re-copy method" work?

So, in Zamyla's walkthrough, she says that for the "Re-Copy" method of vertical resizing, you have to go back to the start of the original row, and then repeat the horizontal resizing. I don't ...
0
votes
1answer
2k views

How to Resize an Image Vertically?

I'm able to resize a given .bmp horizontally, but the code for vertical resizing is not working. Here is my code for vertical expansion. // resize vertically //move pointer to start of scanline of ...
0
votes
2answers
355 views

Why am I not able to write n elements of a specific size correctly?

Given these two blocks of code fwrite(&x, sizeof(y), n, z); And for (int i = 0; i < n; i++) { fwrite(&x, sizeof(y), 1, z); } I was actually working on resize when my resized images ...
0
votes
2answers
375 views

Pset5 resize works but fails check50 TODO- bytes and headers match staff bmp file

I know others have had a similar problem and I have tried to find my error but I see no difference between my bmp file and the staff.bmp. Since reddit seems very quiet these days I am posting here ...
10
votes
1answer
4k views

How to Update bfSize in resize?

In resize problem, we have to update the headers of image. Which attributes should be updated and how do i update bfSize attribute?
1
vote
1answer
378 views

pset 5 resize.cdoes not resize properly. works visually for smiley.bmp but not for small.bmp

Theses are my observations so far: It can resize the smiley.bmp properly without distorting the image. What I'm not sure about is whether or not the contents of its headers are right. It can resize ...
9
votes
2answers
2k views

How does fread progress through each byte in copy.c?

In copy.c (and the other apps using the same start code), how does freed know to read one byte after another? It seems to just do it automatically. Eg, this will read each byte, from first until bi....

1
9 10 11 12
13