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
1
vote
1answer
300 views

pset4: resize - bmp looks good in xxd, won't pass check50

I am so close to completing resize.c here. The resulting bitmaps look perfect in both xxd and when viewed in Image Viewer. However, the program does not pass any check50 requirements aside from the ...
0
votes
1answer
156 views

Pset4 Resize: Incorrect scaling of image

Once again I find myself stumped by CS50. In the below code I have done my best to try to mathematically edit the Bitmap Headers using a variable I named "scalefactor" which is determined by the user, ...
0
votes
1answer
69 views

Resize to 1 but not others, proper info and file headers, is it my pointer location?

I have checked my bitmap file and info headers. They are correct and match the staff.bmp file. However, my resize code for 4 produces this: 0000036: 00ff00 00ff00 00ff00 00ff00 00ff00 00ff00 00ff00 ...
0
votes
2answers
335 views

pset4 resize only works if there is no padding

The bmp images looks pretty much alike with the staff's bmp when there is no padding. But when I use a factor of 3, the image shows random colors, even when xxd padding seems to be ok. I also checked ...
0
votes
2answers
689 views

Pset 4 - Premature end of file encountered

On resize.c, my code compiles and runs without any errors. However, the image produced is a broken image. At the top of the viewer is the error message 'Premature end-of-file encountered'. This is my ...
0
votes
1answer
334 views

Check50 calls errors with resize

My resize does the work pretty well with the smiley.bmp and small.bmp. Although it fails to pass check50. I've checked my program so many times, the headers are the same as the stuff implementation, ...
-1
votes
1answer
94 views

Dose anyone know where memory allocated in resize.c and copy.c? [closed]

I've checked valgrind resize and found out i have a memory leak , 28 byte lost in 3 blocks to be exact , and i don't know where they are allocated , i think in fread and fwrite , but i dont know how ...
2
votes
1answer
1k views

resize in pset4 - can't figure it out

I have been stuck on the resize pset for a few days now. I have looked at all questions on here and reddit but just can't figure it out. When I do the peek, the headers seem consistent with the staff ...
0
votes
1answer
74 views

Similar to other header problems, however I cannot figure it out even with the previous posts

My code, like many others', seems to do the re-sizing ok. However, it seems that the bisizeimage and the bfsize are never correct, even after taking suggestions from other posts. Please refer to the ...
0
votes
1answer
121 views

Pset4 Resize Just a little bit wrong

When I try it with small.bmp, it's just a little bit wrong, the white square in the center is a bit down and larger, anyway know what I'm doing wrong? for (int i = 0, biHeight = abs(bi.biHeight); i &...
0
votes
1answer
165 views

pset4 with correct image and header failed check50

Hi I know this has been asked many times as I've already checked with many similar threads. I have checked for many more hours on my code but still can't figure out what is wrong. Can anyone take a ...
0
votes
1answer
437 views

pset4 resize what is wrong?2

Now it's a little bit better since: :) resize.c and bmp.h exist :) resize.c compiles :( doesn't resize 1x1-pixel BMP when n is 1 :( resizes 1x1-pixel BMP to 2x2 correctly when n is 2 :( resizes ...
0
votes
1answer
460 views

Padding, pset4, resize. weird xxd output

I have a padding problem in the resize (pset4). I can resize any image that doesnt need padding in their new version, but when it comes to padding it just doesn't work. I checked the headers with peek ...
4
votes
1answer
577 views

what is fseek() exactly doing?

I'm stuck since a while in the 'resize' task. Don't fully get my head around the padding. // read scanline pixel/pixel from infile // write pixels to outfile // skip padding // add padding back ...
0
votes
1answer
108 views

Pset 5 Resize - Fail in all tests

The result of resize seems identical to the staff's one. resize.c /** * copy.c * * Computer Science 50 * Problem Set 4 * * Copies a BMP piece by piece, just because. */ #include <stdio.h&...
0
votes
0answers
678 views

Problem with header data, biSizeImage and bfSize have values of small.bmp

So my code is working fine - images resize exactly as they should (as far as my eye can tell) for images both with and without padding, but my header data is wrong when I compare to staff.bmp. My ...
1
vote
1answer
5k views

Pset4, resize, padding

i've been struggling with this for days now. Could someone plz point out what i am doing wrong? It resizes pictures without padding properly, but despite introducing new_padding for resized picture, ...
0
votes
1answer
273 views

Pset4 Resize not working

I'm having trouble with pset4's resize.c. It partly works now! But there are these black vertical lines running through the picture. GDB helped. This is my code now. /** * resize.c * * Computer ...
0
votes
1answer
158 views

pset4 resize what is wrong?

Could anyone help? I have been working on resize for days but there must be a bug somewhere because it still does not work. Just an idea, but it is probably fseek(). Any help is appreciated. int main(...
1
vote
1answer
1k views

Problem with header data in resize.c

My resize.c runs just fine in the terminal, but the newly-created 'resized' image is broken: no image is displayed, and the message 'bogus header data' is shown. I changed the header files like so in ...
0
votes
0answers
686 views

Why does my blown up file in resize.c have bogus header data?

Please help resolve this issue.. Thank you so much!! /** * copy.c * * Computer Science 50 * Problem Set 4 * * Copies a BMP piece by piece, just because. */ #include <stdio.h> ...
0
votes
1answer
102 views

resize.c - header processing seems ok, but lines are getting truncated

I've been working on my program to a point where I believe that my headers are being processed okay, they are matching the same output I get from the staff solution. But, when I am running my program ...
3
votes
2answers
1k views

Why abs(bi.biHeight)?

I have written pset4's resize.c and it took me a while to find the bug in my code. All I want to ask is what is the difference between bi.biHeight and abs(bi.biHeight)? With bi.biHeight some cases ...
0
votes
1answer
596 views

Resize works but failing check50 on every test

So i am having difficulty understanding why check50 fails here. I have tested my image result by looking at its properties and it is re-sized correctly and looks the same as the image file I chose to ...
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
60 views

Too many pixels on "Resize", correct headers/image but does not pass check50!

I have a strange flaw in my program. Initially everything looks fine, it can resize any image correctly and the headers of the staff solutions and mine all match via "peek", so it seems that it makes ...
0
votes
1answer
258 views

Pset 4: Resized image completely green--padding problem?

So I'm struggling a bit with pset4. My resize program results in an outfile that is the correct size with an n of 4 (I used the xxd command to compare with large.bmp) so I don't think it's a header ...
0
votes
1answer
43 views

Optimization: Should I make a new variable or reassign the old one?

I was hoping to get some opinions on the optimal solution for variable changes. In the resize project you have to change the BI and BF variables (height, width, biSizeImage, bfSize etc.). I changed ...
0
votes
1answer
198 views

PSET4. Resize. I can't enlarge the picture in height

[mod removed code] The picture resizes perfectly in Width. But i just can't get it in height. I added that fseek function, but it doesn't really seem to work. The image just gets weird, but still ...
0
votes
2answers
412 views

pset4 resize.c appears to give same ouputs as staff solution but won't pass check50 or diff

I have been working on pset4 resize and it appears (to me at least) to work. I tested it by running smiley through the staff's implementation of resize with n = 4 and comparing results with my own ...
0
votes
1answer
1k views

error: invalid operands to binary expression ('int *' and 'LONG' (aka 'int'))

I'm pretty sure I'm using pointers incorrectly but I don't fully understand why using them in this way is wrong. The compiler seems to throwing out an error on the line (near the bottom of the code) ...
1
vote
1answer
2k views

resize cs50. I am updating headers correctly?

I am struggling with this program. I cannot even check the headers with peek (I am receiving the message "could not recognize sample.bmp"). I am sure my program has several issues, but I would like to ...
0
votes
1answer
110 views

Resize not working (writes RGBTRIPLE too many times)

In resize.c, the image created in my resized image is a tiny image with a black blotch in the middle, regardless of whether I use small.bmp or smiley.bmp as input. When I run xxd, the header in the ...
0
votes
1answer
88 views

Resize problem in pset4

I find that a bitmap which is been provided has following properties. {biSize = 40, biWidth = 3, biHeight = -3, biPlanes = 1, biBitCount = 24, biCompression = 0, biSizeImage = 36, biXPelsPerMeter = ...
0
votes
1answer
361 views

pset4 resize vertical sizing problems. Need help

I am attempting pset4 resize right now and I am running into a bit of problems on the part where you have to vertically size the image by a factor of n. So, my logic is to declear a dynamically ...
0
votes
2answers
497 views

Resize.c creates bitmaps with only first few pixels copied

My implementation creates the headers properly (verified with xxd), so I know it's somewhere in this loop that I'm missing something. I've been trying all sorts of variations of this code, but cannot ...
0
votes
1answer
132 views

My resize.c program is getting partial success

After several failed attempts to fix my code I am still getting errors while trying check50. Below is the code. Help please!
1
vote
1answer
935 views

what is wrong with my resize?

My resize program isn't working. I have narrowed it down to the padding, but cannot find what is incorrect. It resizes images that don't need padding perfectly (multiples of 4), and the header ...
0
votes
1answer
533 views

pset4 - image resizes correctly, but check50 detects some faults

I've been able to resize images correctly (I checked several sizes and images and apparently everything works), but check50 complains saying that it doesn't resize correctly. I think the problem is in ...
0
votes
1answer
550 views

what is wrong with my vertical-resizing algorithm?

It looks like my horizontal resizing is working, but the vertical isn't. I can't figure out where I'm going wrong. I've been testing as described in the pset. ./resize 4 small.bmp student.bmp ~cs50/...
0
votes
1answer
756 views

what is the problem with my resize?

I'm having trouble making getting resize to work correctly even though I spent so much on it. I feel it's somewhere in the for loop where I'm storing the RGBTRIPLE in current_row. Here's my code: ...
0
votes
1answer
96 views

Why is biSizeImage a random number?

I found this anomaly when running peek, then confirmed with gdb that bi.biSizeImage is getting set to 4294966864 when it should be 432.
1
vote
1answer
152 views

How do I tell what offset outptr points to?

I think I'm having trouble pointing to the correct places using fseek although I can't tell for certain since I don't know where outptr points to.
0
votes
1answer
219 views

Bitmap file size

which field in BITMAPFILEHEADER & BITMAPINFOHEADER represents the size of the image? whether it is bfSize of BITMAPFILEHEADER or biSizeImage of BITMAPINFOHEADER as in the specification at https://...
0
votes
1answer
82 views

Resize only works when n % 4 = 0, when n = 1 or when i resize a 2x2-pixel BMP and n =2

I don't know exactly where is the problem. Resize gives me a bunch of different colors when n % 4 !=0. Can you guys help me understand what I'm doing wrong? // iterate over infile's scanlines { //...
0
votes
3answers
194 views

staff implementation : No such file or directory

When I try to run the staff implementation as per the given command ~cs50/pset4/resize it gives me a usage prompt. When I then enter command line arguments like ./resize 4 small.bmp large.bmp I get a '...
0
votes
1answer
515 views

resize pset 4 confused on number of things

I think I have the headers correct except for the new bf.Size not to sure on that one. I am having real problems with resizing the bitmap and I can't figure out what it is, any hints or pointers in ...
0
votes
1answer
202 views

hi could someone please help me with my code because it works fine when i try it but the appliance says it is wrong

hey i don't know why but my code works perfect resizing the images but for some reason i don't understand the check50 command tells me it is not correct because it does not resize anything correctly ...
0
votes
1answer
331 views

pset4 Why I am getting an image with pixels of random colors with resize?

I am stuck with resize.c for more than a few hours now... I got the headers to work properly with the ~cs50/pset4/peek function but still don't understand why I am getting a weird image a result. // ...
0
votes
1answer
295 views

Unknown problem with my resize

Check50 is giving an ok for resizing a 1x1 pixel bmp when n is 1,4, and 5 but not the others. Not sure what's going wrong. Made this again because I thought I knew what the problem was. For some ...

1
9 10 11
12
13