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

Resizing small.bmp with n=4 gives an image with a black rectangle on the bottom left corner

When I try my resize program on small.bmp and enter 4 as n, it gives me a 12x12 picture that is all green, but instead of having the white little square in the middle it has a black rectangle on the ...
1
vote
1answer
375 views

pset 5 resize.cdoes not resize properly. works visually for smiley.bmp but not for small.bmp

Theses are my observations so far: It can resize the smiley.bmp properly without distorting the image. What I'm not sure about is whether or not the contents of its headers are right. It can resize ...
1
vote
1answer
467 views

Looking for clarification on PSET4 Resize - “Rewrite” method

Can I request for some help on my resize.c pset? I'm trying to do the "rewrite" method as per the pset's walkthrough. The pseudocode is as follows: 1 for each row 2 for each pixel 3 write ...
0
votes
1answer
126 views

Why does my output image look like this for pset4 resize?

Please see code below, I know my fseek is incorrect, as im offseting the size of RGBTRIPLE whereas I want to offset the size of the buffer. /** * copy.c * * Computer Science 50 * Problem Set ...
0
votes
1answer
663 views

Not sure why resize.c isn't working

resize.c compiles and runs, but produces an image with a lot of black space. A fresh set of eyes on my code is welcome to see where I have gone wrong. I assume it has to do with padding but I can't ...
0
votes
1answer
109 views

Pset4 resize.c outputting giant block of pixels

Firstly I apologize because there are many posts asking similar questions, but I've read over all that I could find, and it appears to me that my logic should be correct. This leads me to believe ...
0
votes
1answer
261 views

pset 4 resize Image correct but size is off

Hello I am working on pset4 the resize part. My images look correct but they are a few bytes larger than the staffs is. I use peek to check the headers and they match the staffs exactly. The larger ...
0
votes
1answer
75 views

Resize returns correct sized square, only top half is green and white center isn't there HELP!

Still working on this... headers are fine as no matter what I put in as factor the header files match with the staff implementation. Now I'm getting a square of the right size but only the top half is ...
0
votes
1answer
37 views

PSET 3: Color is messed up

I can't figure out how to fix the colors of large.bmp when I run it. It resizes correctly but the pixels are all messed up and don't look like the original. Someone help me? Please and thank you! // ...
2
votes
1answer
185 views

Header Problem in Resize

There is some serious flaw in the header file code of my program since all the variables that was required to be modified is showing error while running the peek program (as shown in in the screenshot ...
0
votes
1answer
85 views

Pset4, Resize: Cant resize vertically. Padding gets messed up.

I'm new here. I've figured out how to resize horizontally, but can't figure out how to do it vertically. here's the code. /** * Copies a BMP piece by piece, resized. */ #include <stdio.h> #...
0
votes
1answer
69 views

pset3 resize (less) compiles but doesn't write into new file for factor != 1

I've been stuck with the pset3 for a long time now and can't figure out why my code isn't working; it compiles fine but doesn't produce an image except for the factor 1. Could someone point me in the ...
0
votes
1answer
45 views

help with pset3: resize (less) resizing horizontally

I am following the pset3 walkthrough and currently at the point where I have to resize horizontally. https://pastebin.com/fHeaYgze My approach is to currently rewrite the resized bi headers as bir (...
0
votes
1answer
52 views

Resize (more) returns “invalid or unsuported file” error

Working on resize (more version) problem set from Week 4. Having reviewed other solutions, and using debug50, peek, and diff, I'm having trouble identifying what in my code is leading to this error. ...
0
votes
1answer
189 views

pset4 resize :- storing horizontal scanline into array

So I declared an array of type rgbtriple as in RGBTRIPLE* buffer = malloc(sizeof(bi.biWidth)); and now i want to read in each pixel n times, so using a for loop like for(int m = 0; m < n ; n++) ...
0
votes
1answer
24 views

pset4: Resize no error seen when compiling still unsupported image format

The problem that I'm facing even while using the debugger is I can't seem to possibly find where I'm going wrong. Please can someone identify where I might be going wrong/ or is my understood logic ...
0
votes
1answer
72 views

Why is my code not working? resize (less comfortable)

So what I tried to do here is to copy every pixel in each of infile's scanlines as many times as the factor provided, then go back to the start of the scanline and do it again but on the next row, so ...
0
votes
1answer
38 views

PSET4 Resize Only works for half an image

So I thought I finished but the image only half way is written. Not sure what I did wrong but the image scales but only the top half. I tried both ways I could think of for the loop but decided using ...
0
votes
2answers
549 views

PSET4 Resize (More) - Downsizing, which pixels to skip, where to readup?

I'm doing PSET4 (More) and fixing the downsizing portion. Given a 8 x 8 pixel image. Downsizing to a 4 x 4 pixel image. n = 0.5 So I'm starting with 64 pixels. New image must have 16 pixels. I ...
0
votes
1answer
38 views

I'm stuck with updating the resize variables, I get segmentation fault

#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include "bmp.h" int main(int argc, char *argv[]) { // ensure proper usage if (argc != 4) { fprintf(...
1
vote
2answers
36 views

Resize less fails when trying to resize small.bmp when n is not multiple of 4 or is 1(probably padding issue)

int oldHeight = bi.biHeight; int oldWidth = bi.biWidth; bi.biWidth *= n; bi.biHeight *= n; int padding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4; bi.biSizeImage = ((sizeof(RGBTRIPLE) * bi....
0
votes
1answer
58 views

Resize Adding Too Much Padding

I'm really struggling with resize on pset4. My loop is adding too much padding, I think by a factor of the scale. I'm still working on the horizontal stretch portion of the program. I'm pretty sure ...
0
votes
1answer
53 views

problem with resize cs50check giving out red errors in some test

the program is working correctly resizes perfectly (atleast i think) but cs50 check gives out an error on todos on some test please guide https://sandbox.cs50.net/checks/...
0
votes
1answer
27 views

PSET 3: Resize (less) malloc?

I've been stuck on this problem for weeks now and I've made headway. Copy/pasting has lead me to a doubling the dimensions of the image but not actually printing the image at twice it's size. I ...
0
votes
1answer
68 views

Pset 4 resize: Image remains same size and image changes

I have an issue that I have been tearing my hair out for a week about. My code does not resize the image and it doesn't keep the image the same. What is the problem with my logic? /** * Copies a BMP ...
0
votes
1answer
117 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
37 views

Resize acting weird in some cases storing 1 pixelXpixel less

I have spent lots of time reading to find someone with alike problem, but simply couldn't. Would be so much thankful for any hint! My resize is acting weird, despite the varriables store correct ...
0
votes
1answer
322 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
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
31 views

PSet3 Resize (Less) = Random Colors when not 1:1

I saw others posted about the same phenomena I am experiencing, but none of their solutions were what I needed. n = 1 works perfectly. This is large.bmp with an n = 2. I realize the first line of my ...
0
votes
2answers
54 views

Wierd out put with resizing small.bmp to 3X3

What could I have been doing wrong? The code works is I resize small to 4X4.It even clears 5 out of * tests. Please help.
0
votes
1answer
158 views

pset4: resize (less comfortable)

I am receiving the below when I check Pset4: :) resize.c and bmp.h exist. :) resize.c compiles. :) doesn't resize small.bmp when n is 1 :( resizes small.bmp correctly when n is 2 Byte 22 of pixel ...
0
votes
1answer
397 views

How does the “re-copy method” work?

So, in Zamyla's walkthrough, she says that for the "Re-Copy" method of vertical resizing, you have to go back to the start of the original row, and then repeat the horizontal resizing. I don't ...
0
votes
1answer
53 views

segmentation fault with my resize code of pset4

i don't understand why I am getting segmentation fault here is the code : http://pastebin.com/KME0ts09
0
votes
1answer
76 views

pset4 help resize

I'm so stuck. The resizing works, but the colors in the output file don't come back in the right order. Can anyone help me with this? int main(int argc, char *argv[]) { // ensure proper usage ...
0
votes
1answer
49 views

Strange error with PSet4 resize.. please help!

I tried to use an array to store the original pixels, and then reprint them 'n' times in the fprint function.. I don't know where it's wrong, everything else looks good to me, the headers match the '...
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
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
54 views

Resize doesnt compile and check 50 can't check my program

My program seems to resize correctly but when i compare headers it seems that there's a bug, i use check 50 and it says that resize.c doesnt compile and the rest of tests give me a yellow poker face ...
0
votes
1answer
76 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
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
1answer
540 views

pset4 - resize: Scaling vertically?

I have the dimensions of the image right, and I have the horizontal scaling working, but I can't figure out how to get the vertical pixels to scale correctly. I've watched the walkthrough repeatedly, ...
0
votes
1answer
99 views

Invalid or Unsupported Image Format

When I run my code and try to open the image that it created, I receive the following error: "Invalid or unsupported image format." Can someone please help me understand why this is happening? I ...
0
votes
1answer
1k views

PSET4: Resize(more comfortable) problem in downsizing

So, I have completed less comfortable version of resize and moved to more comfortable version. I came up with an idea of averaging when we downsize. i.e, if initially pixels were 16x16 and n = 0.5, ...
0
votes
1answer
214 views

Resize : please, i'm struggling to finish resize. There is something that I don't understand to pass check50

Please, help me to understand where should i focus because I spent so many hours on this..... i would love to finish it :) here message from check50 : :) resize.c and bmp.h exist. :) resize.c ...
0
votes
2answers
2k views

cs50 pset4 resize help!

I am stuck at this problem for a long time now. I understand the logic as : the width, padding and length of the image are different. so calculate them differently. Read each pixel from the input ...
1
vote
1answer
542 views

Pset4, resize, fseek, vertical scaling

I think I've gotten the horizontal resizing to work, however, I just don't get what's wrong with my vertical resizing. I've seen similar questions to mine, and I'm pretty sure my problem (assuming ...
0
votes
1answer
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 ...
0
votes
1answer
202 views

pset4 resize.c doesn't work if n > 1

my resize code doesn't work if n is greater than 1 and i don't understand why, if i printf the values they are right but peek values are wrong. My code is: //resize the image // Get n int n = atoi(...
0
votes
2answers
1k views

Why is my array of RGBTriple not working?

I know there are a lot of questions surrounding this topic. Read 'em, still having trouble. The common suggestion here for declaring an array of RGBTriples is something like the following: ...

1
2 3 4 5
13