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
2answers
333 views

Why am I not able to write n elements of a specific size correctly?

Given these two blocks of code fwrite(&x, sizeof(y), n, z); And for (int i = 0; i < n; i++) { fwrite(&x, sizeof(y), 1, z); } I was actually working on resize when my resized images ...
0
votes
2answers
375 views

Pset5 resize works but fails check50 TODO- bytes and headers match staff bmp file

I know others have had a similar problem and I have tried to find my error but I see no difference between my bmp file and the staff.bmp. Since reddit seems very quiet these days I am posting here ...
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
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
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
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 ...
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
122 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
79 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
49 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
51 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
60 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
38 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
38 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,...
0
votes
1answer
77 views

pset3 Resize - Invalid or unsupported Image Format

So i think i finished resizing horizontally but when i try to open the output image to check i get an error saying "Invalid or unsupported Image Format", I read other similar questions here and i ...
0
votes
1answer
48 views

Need help finding bug in resize

I have been staring at this code for hours now and can't find what is wrong with it. It makes a new bmp image that is "n" times larger, but there is something wrong with the reading frame because the ...
0
votes
1answer
65 views

PSET3: Resize (more comfortable) - What am I doing wrong?

This code outputs a seemingly random assortment of colors after the initial scanline, which is correct. If I comment out the for loop that fwrites the scanline "n"(the multiplier) times for every row, ...
0
votes
1answer
89 views

Where am I going wrong with this resize?

My output is a grey square with a white rectangle at the top and bottom. What is it fwriting? // iterate over infile's scanlines (for each row) for (int i = 0; i < bi.biHeight; i++) { //...
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
46 views

resize not correct for all n

Does anybody have any idea what I might be doing wrong in my code for resize? I think the logic of the implementation to be correct, the problem should be somewhere in the syntax... Something that ...
0
votes
1answer
115 views

Rewrite method in Resize (less) is printing wrong large.bmp

So my small image is resizing vertically but I get all the wrong colors. Can someone take a quick peek at my rewrite method to see where I've gone wrong? I've attached a pic of my large.bmp passing in ...
0
votes
1answer
39 views

Pset 3 Resize(less) - How to find the padding for the small image?

In this pset we have to keep track of both the small image and large image paddings. I understand how to calculate the padding for the large image but for the original small.bmp do I use the formula: ...
0
votes
1answer
73 views

cs50-PSET4-Resize-Simply stuck on vertical resizing

I have it upto here and now it does resize, but the image is off. Having a hard time trying to figure out where its going wrong since debugger etc doesnt reveal much info on files and arrays. https:/...
0
votes
1answer
89 views

Pset 3 - Resize - Resizing problem

I'm currently working on resize, and for some reason the pixels in each row (except for one, the middle white one) seem to get resized horizontally except that with the resized pixel its a different ...
0
votes
1answer
75 views

Why isn't resize(more) printing properly?

I am back again with another question about resize more. I feel like I am pretty close, but for some reason it is not resizing vertically properly when the factor is larger than 0 (I haven't dabbled ...
0
votes
1answer
86 views

pset3 resize(less) working correctly, but check50 show a bunch of "image has more bytes than expected

I'm not sure where I went wrong that is causing it to add too many bytes. When I test the program, it seems to resize everything correctly. Code: #include <stdio.h> #include <stdlib.h> ...
0
votes
1answer
60 views

Random Black Pixels on Resize More

I am currently working on Pset3 Resize More. This is something I have never really done before, and I am really not sure if I am missing something major or not. Right now, I know that I can't shrink ...
0
votes
1answer
27 views

pset3/resize same expexted sizes for different scales

While resolving resize(less) problem I've encountered check50 expects the same sizes of files with different scales. How could that be? :( doesn't resize small.bmp when n is 1 Header field biSize ...
0
votes
1answer
379 views

Pset 3 Resize (Less) : Still stuck, likely problem with changing bitmap size

Been stuck on Pset3 Resize (Less) for days... I think i got my headers right, but i am unable to resize the image size properly. When i try to resize small.bmp, it goes from this: to this: Will ...
0
votes
1answer
98 views

Stuck for weeks at resize...help needed

I have been stuck at resize(less comfortable) for 3 weeks now. I have written the following code and can't tell why its not resizing and instead IDE is showing that the image is unsupported or invalid....
0
votes
1answer
106 views

pset3/resize - segmentation fault

I'm getting a segmentation fault and tbh have no idea why. I run valgrind and it all seems good, no memory leak. If I run debug50 the code just switches off halfway through execution on line 43 giving ...
0
votes
1answer
60 views

Help in Resize, biSize headers not sizing correctly

#include <stdio.h> #include <cs50.h> #include <stdlib.h> #include <math.h> #include "bmp.h" int main(int argc, char *argv[]) { // ensure proper usage if (argc != 4) ...
0
votes
1answer
64 views

[Pset 4 resize (less comfortable)]: problem with getting the correct RBG output

I have been stuck at Pset 4 resize (less comfortable) for some time. The program is expected to resize a bmp by a factor n. I get the correct image size but the pixel contents are not correct. Here ...
0
votes
1answer
53 views

Pset4 Colors random

I've looked through a couple of threads and forum questions but I am not able to figure out what are the problems with my code. It resizes correctly but puts out random colors. // Copies a BMP file #...
0
votes
1answer
18 views

PSET4 Invalid File Format when going from n = 1 to n = 2

// 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(stderr, "Please give ...
0
votes
1answer
53 views

PSET4 Resize I don't understand what I'm doing wrong

I'm really sorry to be asking for help but I've been searching for answers and I just don't understand what I'm doing wrong. I think I must be messing something up with the horizontal resize and the ...
0
votes
1answer
81 views

Resize.c "Header field biWidth doesn't match"

I can't seem to figure out how to resolve "Header field biWidth doesn't match." error from the check50. I've gone through my code, but cannot figure out what to change in regards to my biWidth header. ...
0
votes
1answer
28 views

CS50 Resize - Program runs but no output file + problem in vertical resizing

I'm stuck with the resize exercise. I can compile and run the program (no error messages) but no new output file appears. Where did I go wrong? Also, my vertical resizing does not seem to work but I ...
0
votes
1answer
68 views

Resize.c code outputs only top half of image

For some reason my resize code only resizes the top half of an image and stops after that. Any help will be much appreciated. #include <cs50.h> #include <stdio.h> #include <stdlib.h>...
0
votes
2answers
64 views

Memory Leak - PSET4

Hello, I have completed PSET 4 and passed check50 (at least, for the less comfortable version). However, I somehow have a memory leak of 11 bytes that I cannot diagnose. My complete code is here: ...
0
votes
1answer
80 views

resize less comfortable recopy - issues

been on this problem for over a month now. Still cannot resize images as required. When I run code, only the first row is resized. Other pixels return unmatched pixel colours. I would appreciate any ...
0
votes
1answer
81 views

Resize - Struggling to obtain correct bytes

This is the relevant portion of my code: // iterate over infile's scanlines for (int i = 0, biHeight = abs(bi.biHeight); i < biHeight; i++) { // iterate over pixels in scanline for (int j =...

1 2 3
4
5
13