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
2 votes
2 answers
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
1 answer
75 views

Resize pset4 doesn't work correctly

Finally I have this code, it worked scaling up correctly but apparently it has problems with writing the pixels. Here are the code and the result I get by command (./resize 10 small.bmp large.bmp ) My ...
0 votes
1 answer
363 views

pset4 resize.c Invalid or Unsupported Image Format

I'm working on this code for over two weeks and I still don't know where the problem is. My guess is that I have a problem in the Re-copy method (resizing vertically) or in the padding. I screw up ...
0 votes
1 answer
79 views

PLEASE HELP!! cs50 pset4 resize.C complies but cannot resize 1x1 correctly. ,AND large.bmp says"invalid image or format"

Here's the code I finally have. but the issue is the cs50 check says : :) 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 ...
0 votes
1 answer
63 views

What is wrong with my new header info for resize.c?

// copy infile's BITMAPINFOHEADER BITMAPINFOHEADER new_bi = bi; // read new_bi fread(&new_bi, sizeof(new_bi), 1, inptr); // update biWidth of new_bi new_bi.biWidth = new_bi.biWidth * factor; // ...
0 votes
2 answers
247 views

Problem Set 4 resize vertically resizing

Hello everyone. I hope you are well. I am having a bit of a tough time with the resize portion of problem set 4 and I feel I am super close. When I run my program (./resize 4 small.bmp large.bmp), my ...
0 votes
1 answer
181 views

Resize - output files look right but check50 gives errors

I'm running resize. The headers are right when I check them using peek. The files look right (smiley, small, even whodunit). But when I run check50 I get these errors: :( resizes 1x1-pixel BMP to ...
0 votes
1 answer
93 views

pset4 resize vague compiler error

I'm having a rough go trying to get the following code for pset4 resize to compile. I get a massive error message as follows: ~/workspace/pset4/bmp/ $ make resize clang -ggdb3 -O0 -std=c11 -Wall -...
0 votes
1 answer
143 views

pset4 resize.c smiley resizes only horizontally, small is just green when input is 4, various colors otherwise

Alright, I've been working on this for too long, with too little progress. It's time to finally ask. My aim is to repeat each pixel n times, and to also repeat each scan line n times. There is a loop ...
0 votes
1 answer
90 views

ps4 resize, trouble scaling vertically

I've tried to do this by going back to the beginning of each scanline n times. I'm fairly sure that my problem lies in where I've tried to reposition to the beginning of the scanline, but I've changed ...
2 votes
2 answers
177 views

Resize is not passing check50, but still properly scaling larger images

I can get smiley.bmp and large.bmp to scale properly, but not small.bmp, where the former is 3x3 and the latter two are larger (exactly how much larger I don't know) -- so I assume my program only ...
1 vote
1 answer
2k views

pset4 resize, invalid or unsupported image format

I've looked up previous questions and seen people have also tended to change bfSize as well, but when I did this the image was still unsupported so I changed it back. As such nothing in ...
0 votes
1 answer
116 views

pset4 resize works for smiley but fail small

not sure what is wrong with code, but it works for smiley and not for small int main(int argc, char* argv[]) { // ensure proper usage if (argc != 4) { printf("Usage: ./resize n ...
0 votes
2 answers
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 < ...
0 votes
1 answer
67 views

Can't do resize in pset4

This is probably the stupidest question but I can't seem to figure out what's wrong in this code. /** * copy.c * * Computer Science 50 * Problem Set 4 * * Copies a BMP piece by piece, just ...
0 votes
2 answers
117 views

Pset 4: resize correctly, header info perfectly match, but can't pass the 1x1 pixel check

I've tried many numbers, the code correctly resize the image, and the header info perfectly match. But it can't pass the check when the image is 1x1 pixel. I've spent two week on this pset and I am so ...
1 vote
1 answer
78 views

Pset4: resize check50 passed, but valgrind reports a segmentation fault

My code passed the check50 and it runs well. But valgrind reported a segfault. And I don't know why. Here are the report and the relevant code:
0 votes
1 answer
106 views

RESIZE FSEEK() MUST BE ISSUE AS I PRINT CORRECTLY WITH HORIZONTAL RESIZE ONLY

I have been fiddling with this part of the problem set for sometime now. I am pretty sure most of my code is sound as I was able to print the correct 3 x 12 large.bmp (only stretched horizontally). ...
0 votes
2 answers
58 views

can't pass check50

My code works correctly. large creates and correctly. but it simply won't pass check50 /** * copy.c * * Computer Science 50 * Problem Set 4 * * Copies a BMP piece by piece, just because. */ #...
0 votes
1 answer
59 views

Help With pset4 resize please

Can somebody help me understand what's wrong with my code? /** * copy.c * * Computer Science 50 * Problem Set 4 * * Copies a BMP piece by piece, just because. */ #include <stdio.h> #...
1 vote
1 answer
569 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 ...
0 votes
1 answer
175 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
1 answer
60 views

pset4: resize - can't figure out the problem

So I'm trying to figure out what goes wrong in my code and can't seem to find the problem. When I try to resize an image it just copies the first skanlines and the rest of the picture is black. I hope ...
0 votes
1 answer
29 views

problem while running resize.c

here is my code : /** * resize.c * * Computer Science 50 * Problem Set 4 * * resize the image provided n times. */ #include <stdio.h> #include <stdlib.h> #include "bmp.h" int ...
0 votes
1 answer
36 views

problem while compiling resize.c

on compiling i am getting the following error. since i have clearly initialized the biHeight but i dont why the compiler is still showing me this error. here is my code [EDIT: Code removed for ...
0 votes
1 answer
75 views

PSET4 resize, struggling to get properly resized image ( vertically)

Thanks for the help it is resizing the picture correctly now I think but my coparison with staff version gives me lots of fails. : :) resize.c and bmp.h exist :) resize.c compiles :( doesn't resize ...
0 votes
1 answer
46 views

pset4 doesn't pass resize

The output image appears to be correct, but only passes tests when resizing by 1. I tried to use peek and xxd to compare with staff implementation, my output appears to be equal. // read infile's ...
0 votes
1 answer
196 views

pset4 resizing not resizing my image

I'm trying to do pset 5 and can not seem to resize my image, I tried many different way to formulate the image size but somehow its not working, I was wondering if anyone can spot what I am doing ...
2 votes
1 answer
3k views

How does “RGBTRIPLE triple;” know whitch pixel to store?

I'm currently working on the cs50 pset4. My question is pretty straight forward: How does the line (marked with caps lock comment) "RGBTRIPLE triple;" knows whicht pixel currently to store? I get the ...
1 vote
1 answer
168 views

Pset4 resize - half working, padding issue?

So I am really having a hard time with pset4 resize. After 2 days I finally managed to have it resize the smiley correctly, but the small image is still incorrectly displayed (black bg, with glitchy ...
0 votes
1 answer
732 views

Need help with padding in cs50's pset4 resize.c

I am stuck with my pset4. When I try to resize the provided smiley.bmp (8X8 pixels) by the factor 4 everything is fine. Here, know padding has to be considered. The program's output is correct. When ...
1 vote
1 answer
418 views

pset4 resize.c - general struggles

I'm mentally blocked and I was wondering if anyone would take a look at my code and give me a pedagogical clue? I am struggling to get the correct colour output in my resized.bmp; there have been ...
0 votes
1 answer
41 views

Trouble with padding in resize

My code for resize works unless the file I'm resizing requires padding. For the life of me I can't figure out what I'm doing wrong. I've been messing around in gdb for hours. Help and explanations ...
1 vote
1 answer
74 views

Pset4, original large.bmp weird thing I noticed while looking to the raw bytes of the file

I used my implementation of 'resize.c' to recreate 'large.bmp' in a file called 'test.bmp' using 'small.bmp'. I used ./resize 4 small.bmp test.bmp. It looks as it should when viewed, but then I tried ...
2 votes
1 answer
4k views

Pset4 resize.c - bfsize & bisizeimage formulas

First of all thanks for your time. Taking cs50 through edX - struggling as all alone here and videos / lectures are burnt out for information - need real people! Online cs50 really does assume a lot ...
0 votes
1 answer
40 views

resize.c outputting transparent image

Can someone please help me figure out what I am doing wrong here? My program outputs a transparent image, but the image is the correct size. (For example: input image is 4x4 output image is 8x8 but ...
1 vote
4 answers
1k views

check50 gives confusing results for pset4 resize

FOR CS50 STAFF ACTION: When I ran check50 against resize, I got a very confusing result. I've seen that others have seen the exact same result. Here's the problem - the output is giving negative ...
0 votes
1 answer
181 views

Pset4- How to Update FileHeader (Resizing Trouble)

When I run my program by imputing 1, it prints out an exact copy (like it should). But, when I try running my program by imputing 2 (or anything else), it prints out the same size image with seemingly ...
0 votes
1 answer
605 views

pset4 resize: how to copy a row

Just spent 2 days for figuring out how fread(), fwrite() and fseek() works. I tried to use "Rewrite" method from Zamyla's video for vertycal resizing: - Remember pixels in array (first written row of ...
1 vote
1 answer
319 views

pset4 Resize - Trouble Understanding Padding

I'm having a hard time understanding pset4's resize. Although I understand the theory, it's difficult for me to turn it into a program. I do understand that the scan line's total width must be a ...
0 votes
2 answers
474 views

pset4 resize - bfSize value

I think that i have the right code for calculating the bfSize. But its not the same as the cs50 in ~cs50/pset4/resize that gives 0x132 for n = 3, and i get 0x144 with the following formula: if ((...
0 votes
1 answer
137 views

CS50 pset4 resize:

pset4 resize issues I am now struggling with risize.c. Most time it gives me "invalid or unsupported image format" error. It seems that it only works with ./resize 1 small.bmp large.bmp, but even not ...
0 votes
1 answer
61 views

Pset 4 - Resize.c, Green?

Me again, still stuck. I'm almost sure that problem lies in the fseek. Could you guys please help me understand, cause it seems like **it's getting worse... vvvvv It's produces a badly colored ...
1 vote
1 answer
937 views

PSet4, resize.c. Stuck on solution using malloc (recopy)

I am trying to solve pset4/resize.c using the recopy method (i.e. allocating memory and using a buffer to write the line to it and then repeat it). However the final picture only shows black with a ...
1 vote
1 answer
138 views

Stuck at resize.c

int pastwidth = bi.biWidth; int pastHeight = bi.biHeight; int padding = (4 - (SCALE * sizeof(RGBTRIPLE)) % 4) % 4; bi.biWidth = SCALE; bi.biHeight = SCALE; bi.biSizeImage = ((SCALE+padding*SCALE+...
1 vote
1 answer
102 views

pset 4 recover.c code segmentation fault and problems

here's the code i've reached so far. I know it has a lot of mistakes yet and it also gives me a segmentation fault but i'd really like to understand how to think about fixing it. thanks! #include &...
0 votes
1 answer
75 views

pset4 resize.c error

I'm on problem set 4 and stuck on resize.c, it works perfectly... As long as you don't need any padding, then you get some weird results. (Messed up colors) I can't tell what's wrong!, please help. #...
0 votes
1 answer
43 views

Pset4 Resize : Compiles but gives error :File size exceeded when I run resize

I have been working on resize for the last 2 days now, have updated the bitmapfileheader and the bitmapinfoheader and if I do the test mentioned in the specs of resize my headers information matches ...
0 votes
1 answer
1k views

Need help with pset 4 resize.c

I'm stuck at resize.c its not working. Code seems fine to me but it doesn't output expected image. Please help me .. /** * copy.c * * Computer Science 50 * Problem Set 4 * * Copies a BMP piece ...
0 votes
1 answer
93 views

Why do I have a strange black line on the top of my picture in large.bmp, pset4?(

I would very appreciate your help. //variables for original width and height int originalWid = bi.biWidth; int originalHei = bi.biHeight; //update width and height bi.biWidth = scale * ...

1
7 8
9
10 11
13