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
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
190 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
37 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
28 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
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
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
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
20 views

Resize Less - failing to resize small.bmp

Hi guys I've scratched my head about this for a week now and I'm struggling to see what the issue is. The smiley.bmp file seems to be resizing correctly but not the others. Can anyone offer some ...
0
votes
2answers
403 views

Pset4 resize: Invalid or Unsupported Image Format

I have only written my code for the resize (more) problem up to the point where I rewrite the headers for the new outfile. At this point in my code, I only expect my code to work when I have an input ...
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
37 views

Confusion on resize- works sometimes and not others?

So I am working on resize, and I thought I had gotten it to work; it correctly resizes smiley.bmp and large.bmp. However, it can't seem to resize small.bmp to save its life, even when the specs ...
0
votes
1answer
586 views

vertical resize for resize.c

I'm editing the post. I found some code on this side that's using the same pseudocode from Zamyla, so I thought I'd try to understand it and use it in my own program, but I'm having problems. It'd ...
0
votes
1answer
50 views

Pset3-resize explaination

I am struggling to understand how to approach resize problem. I see there are alot of codes available for me to use directly. I do understand the problem, Zymal's pesudocode, but the lack of clarity ...
0
votes
1answer
25 views

pset3 resize less comfortable problem - mixed colour

I have been struggling with cs50 resize for quite some time. Can't figure out why my code is wrong. The output seems to have a right size but it is in a bunch of random colour. // Copies a BMP file ...
0
votes
2answers
1k views

Resize ( more comfortable )

int main int argc, char *argv[]) { // ensure proper usage if (argc != 4) { fprintf(stderr, "Usage: copy infile outfile\n"); return 1; } float f = atof(argv[1]); if(f<= 0.0 && f>=...
0
votes
1answer
20 views

Pset3: Resize (less) loops seems to add extra bytes to headers

I'm working on the CS50 pset3 problem resize (less comfortable). It looks like the resize is working, but I seem to be adding a lot of extra bytes to the header. Looking at the image itself it looks ...
0
votes
1answer
30 views

pset3 resize (less) - double free or corruption (fasttop)

the code is working with small.bmp, but not with large.bmp and i can't understand why. Even resizing smiley.bmp, when n is too big it's not working. Here's the code: // Copies a BMP file include ...
0
votes
1answer
34 views

Unexpected results on resize(less). I could not figure out how is not working the way it suppose to be. Please help

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

CS50 Resize(less comfortable) I can't create OUTFILE

I've been working on this pset for quite a few days now, but my program doesn't seem to be compiling. It keeps saying "could not create outfile"(my message). I have no idea what to do. Any help would ...
0
votes
1answer
55 views

writing pixels n times to array

i'm struggling trying to figure out how to store pixels n times to an array for (int i = 0, biHeight = abs(oldheight); i < biHeight; i++) { // iterate over pixels in scanline for (...
0
votes
1answer
40 views

bfSize error in check50 PSET3 Resize (less)

The code does what it's suppose to do visually. It resizes the image but it appears that there is an error with the bfSize. I have no idea where the mistake is and have tried everything I can think ...
0
votes
1answer
67 views

Pset3 Resize (less) - working fine except on small.bmp

Currently doing resize (less) problem on the CS50 course and can't understand why this code is not working as it should. It will resize the large.bmp and the smiley.bmp but not the small.bmp ...
0
votes
1answer
59 views

Why is my cs50 resize not working?

I have been working on cs50 resize less for 3 weeks on and off and can't seem to get the image to be resized properly. The real problem is I don't know where my program is failing. Can anyone point ...
0
votes
1answer
35 views

I need a little help with resize less comfortable (Please!) - There's a bug in my program

Okay hi! So everything looks good, it's able to resize horizontally & vertically. For instance, when i set n as 4, the 3x3 pixel will be enlarged to However, when i set n to (2 or 3), the ...
0
votes
1answer
31 views

Pset 3 Resize (less) Wrong Colors

I have looked at a variety of other questions about getting the wrong colors, so I know that I have some sort of padding issue, but I have no idea what exactly it is/how to fix it. I get the correct ...
0
votes
2answers
39 views

pset 4 resize (less) Usage Error

Could someone help me understand this usage error when I try to run resize? Usage: resize [-v] [-u] [-c] [-s [rows cols]] I don't see it in the source and don't get what it's supposed to mean. Here'...
1
vote
0answers
25 views

What's wrong with saving the scanline array elements in my code for resize (less), Pset3 problem?

I've solved the problem by recopy method successfully and thanks to many helpful answers to others' questions. Now I'm trying to solve be rewrite method and I think I have a problem with storing ...
0
votes
1answer
73 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 ...
1
vote
1answer
127 views

What's wrong with my Resize (Less) code? Pset3

I've been stuck with Resize (Less) using the "Rewrite" method for days but just can't seem to figure out what's wrong with my code. My code compiled OK, and has no problem with n=1. But it can't ...
0
votes
1answer
38 views

PSet 3: resize (less) bfsize error

I'm SO close (I think!) to being done with "Resize (Less)" after a grueling run. After running check50, I'm a bit kerfuffled. Hexadecimal form of output file seems correct, as do the values of and ...
0
votes
1answer
83 views

pset3 resize less

I'm having some problems and cannot seem to find the bugs. The program seems to function correctly but cs50 check says that the file is too large. Would love to have someone to look at my code and ...
0
votes
1answer
34 views

PSet 3 resize (less)

I'm just trying the "resize horizontally" step for now, but I'm dreadfully confused and can't get it to work. Could someone take a look at my code and nudge me in the right direction? Thank you: /...
0
votes
1answer
31 views

Confusion with understanding how new values are assigned

I do not quite understand how this reuse of variables is incorrect: // save initial values int initial_Height = bi.biHeight; int initial_Width = bi.biWidth; int initial_padding = (4 - (...
0
votes
1answer
37 views

Resize compliling but gives me grey and white blocks lol!

I don't know what went went wrong! I'd understand if it was giving me coloured blocks and it's messed up in some order but it's just white and grey? #include <stdio.h> #include <stdlib.h> ...

1
2
3 4 5
13