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
13 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
0answers
35 views

Pset3 Resize more- Random colours

Absolutely lost on this, checked the header and its correct but when I look at the resulting image from my code its just a bunch of random colors. Also, i'm trying to use the nearest neighbor ...
0
votes
0answers
21 views

pset3 resize more comfortable stuck for scaling down

Been spending a few days tackling scaling down the image. Below is my code. Can anyone help point me towards the right direction or find errors in my code? // Copies a BMP file #include <stdio.h&...
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
45 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
23 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
0answers
12 views

pset3 Resize - How to do vertical scaling by copying the outfile?

Recopy method I'm using an array of data type BYTE to copy lines in outfile and paste them back, allowing me to do vertical scaling in the most efficient manner. However, this method causes garbage ...
0
votes
1answer
19 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
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 ...
0
votes
1answer
24 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
32 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
50 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
56 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
33 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! // ...
0
votes
1answer
55 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
33 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
34 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
28 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 ...
1
vote
0answers
23 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
71 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
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
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
0answers
38 views

Stuck on pset3 resize (less comfortable). Could anyone please take a look at my code?

// Copies a BMP file include include include "bmp.h" int main(int argc, char *argv[]) { // ensure proper usage if (argc != 4) { fprintf(stderr, "Usage: ./resize n infile ...
0
votes
0answers
14 views

Is there supposed to be a RGBQUAD header in smiley.bmp of Pset3's resize since it's a 24-bit BMP file?

I read the background section and it said there's an additional header right after BITMAPINFOHEADER called RGBQUAD for 24- or 32-bit BMPs, but smiley.bmp doesn't have that RGBQUAD header. Is it ...
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
29 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
2answers
35 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'...
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> ...
0
votes
1answer
53 views

Resize pset4 - Can someone check my code

Please someone help me with my code. I think that problem is the fseek function. I don't know how to calculate the number of bytes needed to be skipped. I obtained wierd images with distorted collors. ...
0
votes
1answer
85 views

PSET3 resize vertically help

I'm struggled for 12 hours on resize problem. After trying for so long i reach to this result. The smiley BMP file looks well but it doesn't seem to be fully resized. When i try to resize small.bmp ...
0
votes
1answer
70 views

PSET3 Resize (more comfortable) do not understand why code is not working

I posted my code a few weeks ago, and I have been working on it for a some hours today but I am really stuck as to why it is not working. I have not yet written the code for resizing down. It would be ...
0
votes
1answer
39 views

Pset3 Resize - image has more bytes than expected

I have a problem with this pset3-resize-less. Everything works fine but when I run check50, only first three things are correct: :) resize.c and bmp.h exist. :) resize.c compiles. :) doesn't resize ...
0
votes
2answers
71 views

Problem with CS50 Pset3 Resize Less

The issue that keeps occurring after compiling and running the file, is that the resulting output bmp file changes to an unsupported file format(as stated when clicking on the bmp image file after ...
0
votes
1answer
69 views

PSET3 Resize (more comfortable), resizing f > 1 correctly, but pixels are different colors. Does not work when f < 1

**Relevant code is after comment: // iterate over infile's scanlines This code is able to make a new larger bmp with the correct dimensions, but the pixels are not the same color as the original bmp. ...
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
46 views

PSet4 / Resize / Less: When to put the pointer back to the beginning?

I'm struggling with when to put the pointer back to the beginning. Every time I want to copy the same scanline vertically, I know I need to move the pointer on the input file from the end of the ...
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
46 views

cs50 pset3 resize less

im having some problme with resize and cant find them.. would love some help, ty! // Copies a BMP file #include <stdio.h> #include <stdlib.h> #include "bmp.h" int main(int argc, char *...
0
votes
1answer
20 views

Taking scale factor input in Resize--pset3

I'm trying to take an input integer between 1 and 100 and store its value as n, which I will then refer to as the scale factor, and use it later on in the redefinition of bi.biWidth *= n; and in ...
0
votes
1answer
48 views

CS50 - Pset3 - Resize (Less) - Wrong Bitmap Size

Could someone please review my code for Resize (Less) pset? My code resized everything correctly before I added a couple of extra variables and changed some things up, so I had some base sizes that ...
0
votes
1answer
38 views

resize pset3 i'm having a problem with the downsizing

so my program is working correctly the only problem is with the downsizing i can't make it work correctly here is my code #include <stdio.h> #include <stdlib.h> #include <stdlib.h> #...
0
votes
1answer
23 views

Resize less confortable pset3. Result seems ok if open as hexadecimal but the print result is cropped

After a long struggle with this one I finally got close to completing it. When I open the enlarged file, the lower rows are missing. However I can see these seem to be ok when I open the file as ...
0
votes
1answer
59 views

PSET3 - Resize (Less) : Random colours being printed?

Going through the walkthrough of 'Resize (less)' and currently trying to resize horizontally. When running resize, only a few pixels have the correct colour and others have completely random colours. ...
0
votes
1answer
63 views

I can't figure out the problem in my resize (more) code

I was actually able to solve resize (more), but I'm not able to figure out what's wrong with one of my previous codes (the one I was stuck for longest on) This is my old code: #include <stdio.h&...
0
votes
1answer
37 views

pset3 Resize: Header values not copying into outfile

My output.bmp file yields "Invalid or Unsupported Image Format", and using ~cs50/2019/x/pset3/peek output.bmp yields "Could not recognize output.bmp". Using check50 also gives the error "Header field ...
0
votes
1answer
35 views

pset4 resize: setting bfSize and biSizeImage hexadecimal values

I'm having difficulty setting the bfSize and biSizeImage header values. I should have the correct formulas for both values, however when I write either value to the output file I lose the leftmost ...
0
votes
1answer
46 views

resize : pset3 not all colors are appering after resizing

so im trying to resize an image of green square that has a smaller white square inside it and when i do the resizing the green square resize but the white one disappears i'dont know where the problem ...
0
votes
1answer
33 views

CS50 pset3 i want to resize this image, code is working for some and not for others? Can anyone tell me whats the problem?

int n = atoi(argv[1]); // read infile's BITMAPFILEHEADER BITMAPFILEHEADER bf,bfR; fread(&bf, sizeof(BITMAPFILEHEADER), 1, inptr); bfR = bf; // read infile's BITMAPINFOHEADER BITMAPINFOHEADER bi,...

1
2 3 4 5
13