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
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
181 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
50 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 <...
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
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
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
197 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 ...
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
2answers
209 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
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
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
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
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
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
841 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 ...
0
votes
1answer
281 views

Understanding padding and fseek()

I have a simple doubt that, can padding be put for all of the scan-lines at once? What I mean to say is, that suppose, I have bi.biHeight == 10 then if I Write for (int k = 0; k < padding; ...
0
votes
2answers
56 views

Pset4 Resize: Invalid Format

Every time I try to resize a picture I get an error saying "Invalid or Unsupported Image Format" and I'm not sure what I've mistyped in my code. I've looked at it, I've googled, and a week ago I even ...
0
votes
1answer
370 views

Where do I place bi.sizeImage and bf.bfsize? Are bf.bfsize and are bi.sizeImage correct?

In resize less comfortable I need help with bi.sizeImage and bf.bfsize write outfile's BITMAPFILEHEADER // I Tried placing new_new_bfsize here fwrite(&bf, sizeof(BITMAPFILEHEADER), 1, outptr)...
0
votes
1answer
77 views

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

I have been struggling for a couple of days on the resize less confortable problem. So far my resized image looked enlarged by the right coefficient but the white section remains too small compared ...
0
votes
1answer
103 views

pset 4 resize (less)

Having some growing pains with this pset. I think I have the horizontal resizing figured out with my for loop. My problem is iterating over the same line x number of times (where x is the scale ...
0
votes
1answer
33 views

resize.c says file is unsupported

Please help me find out the bug in my code my resize.c does not print any error but after execution results into a file which is unsupported /** * Copies a BMP piece by piece, just because. */ #...
0
votes
1answer
145 views

Pset4 resize less comfortable, problems with fseek

I'm struggling a bit with resize. I think my headers work correctly as I do get a correct size output, but after the first horizontal line everything goes wack. My guess is that the fault lies in how ...
0
votes
1answer
81 views

PSET4-RESIZE | Weird bmp output while resizing

I'm currently trying to figure out what am I doing wrong while resizing the pixels, the weird location of the pixels suggests me that something is wrong with the padding, but I'm not sure. And it ...
0
votes
1answer
242 views

Pset 4-- Resize

I've gone through my code, and I've progressed now to the point that the outfile finally scaled correctly, but now the colors are off for some reason, and I have no idea why (Infile and Outfile BMPs ...
0
votes
1answer
153 views

PSET 4 (Resize)-- Vertical Scaling

I'm having trouble with the vertical scaling. I've reviewed my code and it seems like it should scale correctly, but instead I get the following picture. My pseudocode for vertically scaling goes as ...
0
votes
1answer
78 views

CS50 Pset4 Resize - Vertical Sizing

I have no problems with the horizontal resizing but can't identify what is the problem in my code with the vertical resizing. Any help would be much appreciated. /** * Copies a BMP piece by piece, ...
0
votes
1answer
94 views

Stuck on resize pset4 using recopy method

My program works fine visually but fails in check50.newpadding is outfile's padding and oldpadding is infile's padding. for (int i = 0, biHeight = abs(oldHeight); i < biHeight; i++) { // temporary ...
0
votes
2answers
103 views

pset4 resize less issue

Can anyone help me with my code, please? I get this result, and don't know how to fix this: My code resizes images horizontally, but does not do the right thing with height: // remember filenames ...
0
votes
1answer
165 views

Pset 4: Resize (Less) Hint needed

Please could somebody give me a hint on my code for the Pset4 resize less comfortable. It seems to resize the image horizontally but Im having trouble making the vertical resizing. Im getting garbled ...
0
votes
1answer
348 views

pset4 resize less output issues

Have been trying to figure out what's wrong with my code, but having issues with it. Can someone please point me in the right direction? What I'm getting with check50 :) resize.c and bmp.h exist. ...
0
votes
1answer
143 views

pset4 resize working but failing checks?

it works, but cant get past test 4 :) resize.c and bmp.h exist. :) resize.c compiles. :) doesn't resize 3x3-pixel BMP when n is 1 :( resizes 3x3-pixel BMP to 6x6 correctly when n is 2 resized ...
0
votes
2answers
255 views

CS50 resize "Invalid or Unsupported Image Format" in the IDE

I know that this question has been "answered" numerous times but those revelations haven't related to me for some reason. My code is edited from copy.c and a few other resources. The FILE reads and ...
0
votes
1answer
34 views

Resize duplicating only some rows

I'm so close but when resizing the smiley, my code is only resizing certain rows. Any ideas why? /** * Copies a BMP piece by piece, just because. */ #include <stdio.h> #include <stdlib.h>...
0
votes
1answer
68 views

resize unsigned integer overflow problem ? I did try the -(long int) and long offset for -offset but still the same error

Please, as I wrote, I tried both for long integer in fseek but still I have the unsigned integer overflow message. Can u help me pls ? tsk here the code : // data increase by the n value for ...
0
votes
1answer
207 views

Pset 4 Resize fseek()?

I'm looking over my resize code rn, but have been stuck for a while now, was wondering if anyone could point me in the right direction. The resized images have colors beside green, which I would ...
0
votes
1answer
42 views

Pset4 resize - only partially working

I've been struggling with this for a while. After reading other posters questions and reading the responses I've managed to come up with code that compiles and works correctly only if the value of 'n' ...
0
votes
1answer
194 views

Pset4 resize strange resized image and does not resize after some value

I am stuck since I have no idea what is wrong with my code. I believe my resizing code is correct. I think I'm not changing the headers correctly, which is giving me this image: Also, i think it ...
0
votes
1answer
43 views

pset4 resize - can't write all the characters from infile to outfile

everyone! I really need your help. I'm working on pset4 and trying to understand the logic of resize problem. I have two files:testinp.txt and testout.txt. Inside of testinp.txt I have: ...
0
votes
1answer
104 views

fseek doesent do what i expected

so what i am trying to do is to make fseek return to a new line as long as its smaller than factor i need to resize with. so fseek retruns to a start of line as long as its need to print those ...

1
3 4
5
6 7
13