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
100 views

Trouble with PSET4: Resize vertical resizing (recopy approach)

So I'm having a bit of trouble implementing the recopy approach to vertical resizing for this PSET. The horizontal resizing seems to work just fine, but the vertical resizing is.. bad. I have a ...
0
votes
2answers
63 views

Pset4 Resize question

i am kind of stuck right now.. any suggestion? i made this for loop to repeat pixel n times. for (int n = 0; n < scale; n++) But if i do this, padding also gets repeated "scale" times. Is putting ...
0
votes
1answer
71 views

PSET4: Resize (less comfortable) - confusion regarding segfault and horizontal resizing

Here is what I've got for PSET4: Resize so far. I get a segfault with proper usage of the program (i.e ./resize n infile outfile), and I have no clue where it's coming from. Furthermore, is my ...
0
votes
1answer
75 views

Unable to Enlarge BMP by a Scale Factor of n

Despite all my attempts, I could not figure out how to fix my code to work properly. The vertical rows come out, but they always are different, random colors. On the other hand, the horizontal rows ...
0
votes
1answer
182 views

pset4 Unsupported File Format

Been messing with this code for days, but when I was debugging it the program went from printing a distorted image to simply saying Unsupported File Format in the command line. Not sure where I'm ...
0
votes
1answer
103 views

Multiple errors on pset4 resize, less comfortable

I have multiple errors when using check50 and I am not sure why. I realize that multiple people already addressed similar error as mine, but I do not understand the explanations. I would appreciate if ...
0
votes
1answer
52 views

Invalid or Unsupported Image Format (Recover)

// Copies a BMP file #include <stdio.h> #include <stdlib.h> #include "bmp.h" int main(int argc, char *argv[]) { int n = atoi(argv[1]); // ensure proper usage if (argc != 4 || (n > ...
0
votes
1answer
28 views

CS50 - pset4 - Resize

I have written the below code. However, when i run the program, it said that the "Invalid or Unsupport format". Can anyone advise the area that I can make changes? Thanks. // Copies a BMP file #...
0
votes
1answer
95 views

Final bfSize calculated does not match output file size

Hi, everyone! I am currently finishing (after quite some thought and a lot of trial-and-error) the less comfortable version of the resize problem from pset4, which, as you probably know, resizes BMP ...
0
votes
1answer
74 views

pset4 resize(less) vertical

My code seems only work for horizontal but not vertical. I have tried different for loops but nothing works. Any suggestions would be extremely helpful. Thank you. // Copies a BMP file #include <...
1
vote
1answer
107 views

Stuck on resize.c (less), Can't resize height

I've been stuck on this for several days. I'm trying to resize the provided smiley.bmp with n=4 as that file shouldn't require padding. I get a new .bmp image of the correct size (32x32), but the ...
0
votes
1answer
23 views

Pset 4: Resize always yield "Invalid unsupported image format" even for n=1

I am stuck on resize (less). The problem is I think, header of new bmp is always corrupted no matter what. My code compiles and I tried to identify error using debug50 to no avail. Please help me ...
0
votes
1answer
43 views

resize(less) am baffled dont know whats changed pls help

okay so yesterday I started resize and made a bit of progress, today I played around with it to try and fix the alignment issues I had and somehow totally screwed it up and now I'm getting colours ...
0
votes
1answer
124 views

pset4 - resize: padding issue

Can someone please help me, I am trying to get horizontal resizing working before moving on to adding vertical resizing (as the walkthrough suggests). My code works to resize smiley.bmp and large.bmp ...
0
votes
1answer
75 views

resize rewrite method

I've just successfully completed resize less. It took me a lot of time, but, final correction that I needed to make surprised me a lot. There was a huge mess of RGB triples when my fwrite function was ...
0
votes
1answer
123 views

Not sure what I need to change in resize.c (PSET4)

// Copies a BMP file #include <stdio.h> #include <stdlib.h> #include "bmp.h" int main(int argc, char *argv[]) { // ensure proper usage // I changed to ...
0
votes
1answer
60 views

Resize - file header problem

I'm having trouble rewriting the file headers here. It works for a resize factor of 1, but no other resize factor. What am I doing wrong? // Copies a BMP file #include <stdio.h> #include <...
0
votes
0answers
92 views

Problem in pset4 Resize

I am trying to solve pset4/resize.c I have been spending hours on trying to determine the mistake. Here is the code: // Copies a BMP file #include <stdio.h> #include <stdlib.h> #...
1
vote
1answer
139 views

Resize help with padding and moving file pointer

Been working on this a while. Can't seem to get my padding and my moving file pointer back to rewrite row right (or at least I think thats whats giving me trouble), have tried a bunch of different ...
0
votes
1answer
76 views

PSET 4: Resize. Does not work with dynamic buffer, only static

I managed to make resize work using a static array to store a row of pixels for the outfile (rewrite method). However, my first attempt with a dynamic array doesn't work, and I don't understand why. ...
0
votes
1answer
198 views

Pset4 resize code working, headers correct, check50 fails

My code seems to work perfectly, and the headers match those of the staff solution. However, it fails check50, with the message "Image has more bytes than expected" showing up for almost all criteria. ...
0
votes
1answer
23 views

help me to execute pset4 resize program

i have my bmp file in the same directory but the error shows me that it could not find the file. I tried deleting the resize directory but the same error occurs.. what to do??
0
votes
1answer
127 views

For loop vs fwrite for resize

I have managed to finish but i have some queries regarding how fwrite exactly works. If you are new to pset4, the intention of my code is to fwrite the content of triple n times after i have fread ...
1
vote
1answer
63 views

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

#include <stdio.h> #include <stdlib.h> #include <string.h> #include "bmp.h" int main(int argc, char *argv[]) { // ensure proper usage if (argc != 4) { fprintf(stderr, "Usage: ...
0
votes
1answer
118 views

bfSize different colors resize pset4

I just cannot stop getting funky different colors when I resize, and I see it must be some padding issue. I used the specs and peek to compare my file student.bmp with the staff.bmp. It shows in red ...
0
votes
1answer
323 views

resize runtime error pset4

My code compiles, but when I execute this I get: runtime error: index 4 out of bounds for type 'RGBTRIPLE [newbi.biWidth]' Where does 4 come from? Is it the number of arguments?? Thanks for any help....
0
votes
1answer
50 views

Unable to find bug in resize.c

Hi i am facing some bug in my program and am unable to figure out. What it should do is this: for each row   for (n-1) times    write pixels ,padding to outfile    send ...
0
votes
2answers
44 views

Unable to tell why resize doesnt work

below is my code for resize.c in pset4 and i could not figure out where the error / logic problem is. Few changes to the code are as below: 1) I used atoi to convert n to a int. 2) Changed values of ...
0
votes
1answer
92 views

pset 4 resize please help

//CREATE A PROGRAM TO RESIZE A BITMAP FILE //include C libraries #include <stdio.h> #include <stdlib.h> #include <math.h> #include "bmp.h" int main(int argc, char* argv[]) { //...
0
votes
2answers
210 views

pset4 how does incrementing j help to iterate over pixels?

I'm currently working my way through understanding the code of copy.c used in "whodunit" and "resize". This loop is supposed to iterate over the scanlines of a Bitmap (by incrementing i) and within ...
0
votes
1answer
93 views

pset4 resize problem

I have written a code to resize an image but the output image is not matching the input. The image is scaled fine but its content changes. Can somebody look at my code and tell me what is wrong? ...
0
votes
1answer
445 views

PSET4 resize (less) check50 error

This code works as expected visually, however when going through check50, it returns an error (resizing with a factor of 2 for example) "Header field bfSize doesn't match. Expected 0xae, not 0x126" ...
0
votes
1answer
73 views

Pset4. Resize, less comfortable. Don't understand why code is working

I was having issues with my headers because I chose to create a separate header file for my new header changes. However, my code was not passing the check50. Upon researching and questioning, I found ...
0
votes
1answer
61 views

PSET4. Resize, less comfortable. Something is wrong in my code

I am on pset4 and working on resize, less comfortable. I chose to follow the "rewrite" method but it seems that I am going wrong somewhere and I have no idea what to do. Any advice or help is most ...
0
votes
1answer
62 views

pset4 ./resize .2 (.4)

I'm done with resize [more]. And check50 was ok. But when i check my program for not 0.25/0.5 size, but for size 0.2/0.4 the image was fail ./resize .2 large.bmp student.bmp .1 - OK .15 - OK .2 - ...
0
votes
1answer
116 views

PSET4. Resize, less comfortable. "Rewrite" method not working for me

I am on pset4 and working on resize, less comfortable. I chose to follow the "rewrite" method but it seems that I am going wrong somewhere and I have no idea what to do. Any advice? // determine ...
0
votes
1answer
50 views

Pset 4 - resize. Problem with proper padding

I've been stuck on resize for a while and I think I nearly have it. My outputs are nearly accurate except for the fact that some of the pixels are not being placed properly, and I think this has ...
0
votes
1answer
29 views

Pset 4...image resizes only smiley

Now the simley image gets resized properly....but the small.bmp does not...i checked the header information via specification...but both turn out be correct....here is the code.. #include <stdio.h&...
0
votes
1answer
522 views

pset4 resize working perfectly but can't pass check50

I am in the 4th problem set in cs50 trying to do resize.c. I worked on it for about 3 days and finally everything is going great the program can resize whatever bitmap photo I throw at it. I was ...
0
votes
1answer
73 views

Resize.c (less) writing excess padding

I'm on Pset4's Resize (less comfortable), using the recopy method. When I plug in small.bmp and resize it with a scale factor of 2, I get a black block in the middle. With any higher scale factors, it ...
0
votes
1answer
53 views

Image does not resize properly, with recopy method. PSET 4 Resize

So I have been stuck for 1 week, i am not getting it, can somebody give me a hint so to what I am doing wrong, I am trying to do it via recopy method. originalHeight = labs(originalHeight); //Recopy ...
0
votes
1answer
61 views

fread seems to break my program

I've been spending a lot of time trying to get my head around the fread and fwrite functions. In said (vain) attempts, I made some little changes to the copy.c program that is provided as part of ...
0
votes
1answer
115 views

Pset 4 Resize less **Spoiler ** still stuck

Had to walk away from this but looking over it again and hitting a wall. Can someone take a look ?? #include <stdlib.h> #include <stdio.h> #include "bmp.h" int main (int argc, char *argv[...
0
votes
1answer
36 views

Spoiler Pset 4 Resize less, 2nd go around

I have worked on this so many hours. Thought I had fixed things up but still not resizing correctly. Can someone check my code and let me know where I am messing up ?? #include <stdlib.h> #...
0
votes
1answer
332 views

Need help in Pset4 resize less. Compiles but biSize headers not sizing correctly

[solution code removed] ) resize.c and bmp.h exist. :) resize.c compiles. :( doesn't resize small.bmp when n is 1 Header field bfSize doesn't match. Expected 0x5a, not 0x48 :( resizes small.bmp ...
0
votes
1answer
56 views

I have no idea how to implement padding or vertical rows

I've been stuck on this problem for days now, my problems arrise from the following: 1- I have no idea how to implement padding 2- I have no idea where the vertical loop would go 3- I have no idea ...
0
votes
2answers
117 views

Pset4 (less) - vertical resizing

I have resized horizontally successfully but am having trouble with vertical resizing. I have done a header check against the staff headers and they are the same so I don't think the problem is there. ...
0
votes
1answer
77 views

Pset4 resize (less) Invalid file format

This pset has been super hard for me. I am trying to resize horizontally before I tackle vertical and I am able to compile and run the program but when I go to open the output file I get the error ...
0
votes
1answer
32 views

Resize infile won't read from argv

When I try to assign char *infile to argv[2] all that I infile ends up being is "". In that first for loop it prints fine but it won't work with the infile. The outfile also doesn't have any problems ...
0
votes
1answer
851 views

resize malloc bug and issue with file output

I have a number of issue but the most disatarous is my malloc ./resize': corrupted size vs. prev_size: 0x0000000001903480 *** when calling the function currently. The problem there (besides sucking at ...

1 2
3
4 5
13