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
44 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
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
2answers
547 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
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
71 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
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
36 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
1answer
311 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
115 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
71 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
37 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(...
0
votes
1answer
52 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/...
1
vote
2answers
34 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
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
155 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
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
35 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
52 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
27 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
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
90 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
74 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
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
74 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
51 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
2answers
52 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
54 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
83 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
26 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 ...
1
vote
1answer
541 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
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: ...
0
votes
1answer
537 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
213 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 ...
0
votes
1answer
308 views

PSet4 image invalid

Here is my code. It seemed to be working but apparantly my image is undefined. I know that I have to catch the if condition at the beginning but can anyone tell me why my image was undefine /** * ...
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
1answer
94 views

My resize.c shows twisted outfile image

I've been struggling with resize coding for more than three weeks. Still cannot get the correct outfile. Instead it shows 'twisted image' as shown below (image viewer zoom fit). There must be ...
0
votes
1answer
114 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
153 views

CS50 resize.c image problems… Whats wrong?

I'm having trouble with my program. It compiles and everything but 1) large.bmp appears as an "Invalid or Unsupported Image Format" and 2) I fail all the Check50 tests. I've been editing my code for ...
0
votes
1answer
109 views

Check50 passes in some instanses, despite images and headers identical to staff's?

I compared my headers to the staff's, and they were the same, as well as use the "diff" command and they were the indeed the same. I have read other forums on this site, and I believe the problem lies ...
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
77 views

Pset4, square is completely green

So now my square is completely green, but I believe it ressizes correctly. my code is as follows: #include <stdio.h> #include <stdlib.h> #include "bmp.h" int main(int argc, char *argv[...
0
votes
1answer
189 views

Pset 4 resize - Help with fseek using current position

I just need a hint to point me in the right direction.. I can't think of a formula to make fseek go to the next line. If I leave it as it is I think it will just keep rewriting the same line in the ...
0
votes
1answer
60 views

Pset 3 - Resize - Resizing problem 2

I'm currently working on Resize, and it just doesn't work as it should (see picture (scale value used was 2). Any suggestions? Here's my code: https://gist.github.com/AProgrammerZ/...
0
votes
1answer
83 views

pset 4 resize.c algorithm problem

I can't figure out why my code wont work. Please help. My idea for solving the height problem was write one line of the image move the file cursor to the beginning of the newly written line read in ...
0
votes
1answer
98 views

Despite having identical Headers to the staff's, image is comes out incorrectly?

// declare updated headers BITMAPFILEHEADER NewBf = bf; BITMAPINFOHEADER NewBi = bi; // update BITMAPINFOHEADER NewBi.biWidth = bi.biWidth * n; NewBi.biHeight = bi.biHeight * n; // determine ...
0
votes
1answer
368 views

check50 error on resize.c pset4

My program for resize.c is able to resize the bmp's provided with the pset4, for example small.bmp, smiley.bmp but after running the command check50 2014.fall.pset4.resize bmp.h resize.c on terminal ...
0
votes
1answer
97 views

pset 4 resize Invalid or Unsupported Image Format

I keep getting an error from the IDE saying "Invalid or Unsupported Image Format" and I haven't been able to figure out why. I have looked at other questions but none seem to help. bi_new.biWidth = ...
0
votes
1answer
117 views

without changing the size the image is resized how ?

I haven't re-sized the new bitmap file but still i get an output which is same as large.bmp. I dont know how this work even if I haven't changed the size of image or the file
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, ...

1
2 3 4 5
13