Questions tagged [padding]

The tag has no usage guidance.

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

pset4 resize size is correct, but the pixel colors are all wrong

I'm trying to resize the image using the "recopy" method Zamyla stated in the video, but I can't figure out why the colors are all messed up. I've tried looking at other questions, but it hasn't ...
user avatar
  • 3
0 votes
1 answer
64 views

CS50 Pset4 Resize Padding. again

CS50 Pset4 Resize Padding. again I need help! I got lost The code creates a scalable bmp file but is distorted. I think there is a mistake with padding int main(int argc, char* argv[]) { // ...
user avatar
0 votes
1 answer
74 views

Pset4 - Resize problem with vertical scaling

int main(int argc, char *argv[]) { // ensure proper usage if (argc != 4) { fprintf(stderr, "Usage: ./copy infile outfile\n"); return 1; } // remember filenames int n = ...
user avatar
  • 1
0 votes
1 answer
129 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 ...
user avatar
0 votes
1 answer
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 ...
user avatar
0 votes
1 answer
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 ...
user avatar
0 votes
1 answer
298 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; ...
user avatar
0 votes
1 answer
80 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, ...
user avatar
0 votes
2 answers
59 views

pset4 padding calculation last %

In pset4, whodunit, copy.c padding is calculated: int padding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4; I cannot understand the use of last % 4. Could following statement have the same ...
user avatar
  • 5
0 votes
1 answer
108 views

pset4 recopy padding issue

I feel like I'm close, since this code will resize small.bmp when the larger file's lines require no padding (for instance, n = 4), but fails with a resize factor that does require padding (1, 3, 7). ...
user avatar
1 vote
1 answer
202 views

pset 4: resize adding in black pixels

Whenever I run my program on small.bmp passing in: $ ./resize 4 small.bmp larger.bmp I end up with this: It seems like the size is correct, but it's adding a black pixel after each line in the ...
user avatar
0 votes
1 answer
127 views

pset4 resize.c : output matches staff's but colour of square is always grey/white!

I have been working on resize.c(less comfortable) for days (tears hair out). My code is able to resize just fine but the colours of the output image are messed up. I just can't seem to find any ...
user avatar
0 votes
2 answers
133 views

pset4 Resize - black bars of padding?(not sure how to get rid of them)

First time on this so be gentle. I have been at a standstill on this for hours. Below is my code and I can't seem to find out why these black bars(padding)show up. Any help? #include <stdio.h> #...
user avatar
  • 1
0 votes
1 answer
384 views

determine padding for scanlines in copy.c

Line 65 in copy.c int padding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4; Question is why do we need last modulo operator in bold? Even without it, it gives the right answer.
user avatar
1 vote
1 answer
102 views

Pset 4 Resize makes a very colorful picture (not green!)--padding problem?

Well, it looks like I'm not the only one having issues with padding (I suspect that's my problem). Specifically, if I test my version of resize with an enlargement factor of 2 (using small.bmp as ...
user avatar
0 votes
1 answer
124 views

pset4, copy.c padding

I understand why padding is necessary and how it works, but some 'experimenting' and comments left at the given code have made me question my understanding of padding. for (int i = 0, biHeight = ...
user avatar
  • 17
1 vote
1 answer
425 views

Problem with horizontal resizing Pset4 resize

I'm working on Pset 4 re-size. I've got the header files working correctly (as tested by using the "peek" function, and by using a factor of 1 - my programme creates perfect copies of any of the .bmp ...
user avatar
0 votes
1 answer
51 views

Issues with padding - why am I getting a black image for every outfile?

See code below: /** * copy.c * * Computer Science 50 * Problem Set 4 * * Copies a BMP piece by piece, just because. */ #include <stdio.h> #include <stdlib.h> #include "bmp.h" int main(...
user avatar
0 votes
1 answer
138 views

PSET4 Resize: image resizes but fails check50 (PADDING or HEADER???)

I thought I was confused before I had this "clarification": check50 gives confusing results for pset4 resize. Now I'm flat out lost. For this challenge I actually tried to use a function to hold all ...
user avatar
0 votes
1 answer
387 views

pset4 resize fseek() - non proper work

I have similar question as there was asked, but can't find answer. Here is my code: /** * copy.c * * Computer Science 50 * Problem Set 4 * * Copies a BMP piece by piece, just because. */ #include &...
user avatar
0 votes
1 answer
148 views

pset4 resize problem with padding

I've been trying with this problem for more than a week now .. I guess I've figured out fseek() .. and the code works fine with files without padding, but it doesn't with ones that have padding ... so ...
user avatar
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 ...
user avatar
  • 13
0 votes
1 answer
37 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 ...
user avatar
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. #...
user avatar
0 votes
1 answer
41 views

I am implementing resize.c. The program compiles but I cannot download the larger image. It says that it is in invalid format?

https://sandbox.cs50.net/checks/480ca0b5599747bf966ef0c139584d60 /** * resize.c * * Computer Science 50 * Problem Set 4 * * Magnifies a BMP piece by piece in accordance to the inputted value by ...
user avatar
0 votes
1 answer
181 views

pset4 resize cannot figure out what's wrong

Ok I've been working on this for hours and I'm baffled. The header file all matches the staff implementation having checked it through peek. But when I run resize 4 on small.bmp I get this: So that ...
user avatar
  • 9
0 votes
1 answer
106 views

resize.c problem with padding

Yet again I have a problem with my resize.c problem. The output file is only correct, when no padding is needed(when the width is a multiple of 4). This can be approved by the check50 output(https://...
user avatar
0 votes
1 answer
117 views

pset 4, resize.c is not working

Here is the code for resize.c I am stuck for quite some time now and i am not able to figure out where i am wrong. please help. bi.biHeight = height*n; bi.biWidth = width*n; // determine new padding ...
user avatar
0 votes
1 answer
999 views

CS50 Pset4 Resize Padding

Can you please tell me where I am wrong? include include include "bmp.h" int main(int argc, char* argv[]) { // ensure proper usage if (argc != 4) { printf("Usage: ./resize n ...
user avatar
0 votes
2 answers
227 views

pset4 Resize: Don't understand problems with size and dimensions

After digging to implement resize, I don't get it if issues come from resize vertical, horizontal or even padding. By running my program on peek, this is what display (* highlighted difference between ...
user avatar
0 votes
1 answer
177 views

pset4 - Resize: Not sure what's wrong

I'm not quite sure why my program doesn't work correctly. It's been like this for days, so I thought someone with a fresh mind on the issue could be handy. My code is as follows: int width = bi....
user avatar
0 votes
1 answer
388 views

pset4 Resize adding padding... and resize in general (HELP ME!)

I'm having a really hard time grasping pset4, I think I've changed the header files correctly but I'm not sure.. I feel like this pset is WAAAY harder than the last. I still barely understand a lot of ...
user avatar
0 votes
1 answer
741 views

What exactly is padding in pset4?

Can you clearly explain what exactly is padding in pset4? Why I need to add it?
user avatar
0 votes
1 answer
135 views

pset 4 Resize is giving me a distored image, is it problem with the padding?

As the title implies, when I am executing my resize I am getting a distored image. I am guessing that it might be the issue with my padding, as the top half of the codes are more familiar to me, while ...
user avatar
  • 27
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 ...
user avatar
  • 3
0 votes
1 answer
198 views

Please explain why copy.c skips over padding and how it then adds it back?

This is a two part question: 1) Why does copy.c have to skip over padding? 2) If it already skipped over the padding, why is it adding it back? Wouldn't this make extra padding? I have been reading a ...
user avatar
  • 53
2 votes
1 answer
1k views

pset4 resize - fseek help (I think)

I'm on the verge of giving up. I've been stuck on this problem for weeks. I managed the headers, and I think I set up the loops right to write the pixels correctly. I just can't wrap my head around ...
user avatar
  • 88
0 votes
1 answer
197 views

CS50 resize Problems

I have been working with resize for a couple weeks on and off. My pseudo code makes sense, but when I put it into action, it is not working. I only pass a portion of check50. I think it has to do ...
user avatar
1 vote
2 answers
131 views

Yet again, problem with padding

I am having a problem with my code, and I think it has to do with the use of fseek. I have read a lot of the articles on the cs50 Stack Exchange, and tweaked my code a lot, but my problem still ...
user avatar
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 ...
user avatar
0 votes
1 answer
476 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 ...
user avatar
1 vote
1 answer
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, ...
user avatar
  • 17
0 votes
1 answer
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 ...
user avatar
  • 3
1 vote
2 answers
994 views

Why does copy.c skip padding?

I'm having a bit of a hard time understanding certain lines of code in copy.c. For example below: // skip over padding, if any fseek(inptr, padding, SEEK_CUR); // then add it back (to demonstrate ...
user avatar
3 votes
1 answer
1k views

PSET 4: Why is padding required?

I am currently going through the PSET 4 sheet and have just read up to the part where it is being explained that if the number of bytes in each scan line is not a multiple of 4 then it is padded out. ...
user avatar
  • 131
0 votes
1 answer
332 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. // ...
user avatar
0 votes
0 answers
317 views

PSET4 Resize Works for Smiley but not Small

Hi I can get Resize to work fine for Smiley for all sizes, but I can't get ANY sizes to work for Small. Please help! I think the problem has to do with the padding, but not sure why it would work ...
user avatar
  • 1
2 votes
1 answer
2k views

Resize's Padding Issue

My resize for pset4 finally worked and I can resize the small.bmp (that green square) properly. however it doesn't work for all the check50 requirements(except for compiling and running) and i don't ...
user avatar
1 vote
1 answer
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 ...
user avatar
1 vote
0 answers
209 views

pset5: Resize does not consistently work

I am having a problem with resize. I can resize smiley.bmp perfectly at X1, X2, and X10, but not for factors between 2 and 10--I just get an abstract blob of colors. I assume this has something to do ...
user avatar
  • 11