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

pset4 resize - can't write all the characters from infile to outfile

everyone! I really need your help. I'm working on pset4 and trying to understand the logic of resize problem. I have two files:testinp.txt and testout.txt. Inside of testinp.txt I have: ...
0
votes
1answer
104 views

fseek doesent do what i expected

so what i am trying to do is to make fseek return to a new line as long as its smaller than factor i need to resize with. so fseek retruns to a start of line as long as its need to print those ...
0
votes
1answer
78 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
0answers
141 views

pset4 resize Invalid or Unsupported Image Format

I've been trying to find the error in my code for a couple of days, when I try to open large.bmp I have the error message "Invalid or Unsupported Image Format", and I think it is because I'm doing ...
1
vote
1answer
52 views

Resize PSET4 Invalid or Unsupported Image Format

So here is my code, I think I'm going wrong because the BITMAPFILEHEADER and BITMAPINFOHEADER are not being updated, so there are too many bytes being written to the output file, am I right with this? ...
0
votes
1answer
193 views

Week 4. Resize - Less Comfortable

I hit a wall a while ago on 'more comfortable' and since downgrading have been trying attempts on this for a few days - fully aware i'll be missing something, either in my logic or implementation but ...
0
votes
1answer
39 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
105 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
2answers
1k views

Problem with resize (less comfortable) CS50 [duplicate]

I am working now since 2 days on this code and really don't find the mistake. My guess is that something with the fseek is wrong, but I can't manage to resolve it. The output image (large.bmp) has at ...
0
votes
1answer
107 views

pset4 recopy padding issue

I feel like I'm close, since this code will resize small.bmp when the larger file's lines require no padding (for instance, n = 4), but fails with a resize factor that does require padding (1, 3, 7). ...
0
votes
1answer
121 views

Issue with padding when horizontally resizing. (pset4, resize (less))

So far, I have only implemented a horizontal resize to my code (I will implement the vertical resize once I have resolved this issue), and, though the code works properly on images such as large.bmp ...
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
93 views

resize.c unsupported format or invalid image error

In pset4's resize.c, everytime I run the program, it gives me "unsupported file format" as result as it should if the infile is not 24-bit uncompressed bmp 4.0 but, I have used copied and pasted the ...
0
votes
1answer
385 views

PSET4 - Resize (less)

I am unable to figure out what I am lacking or doing wrong in my code. The output image large.bmp becomes just some random colors. Hopefully, someone can guide me here. #include <stdio.h> #...
0
votes
1answer
61 views

cs50 pset4 resize returning distorted image

I am working on resize and cannot figure out why my image is turning out distorted. The images are enlarged but look completely different. Can someone please tell me which section of my code is ...
0
votes
1answer
97 views

Resizing vertically

I am having trouble to make my file resize vertically. My code is below for (int i = 0, biHeight = abs(bi.biHeight); i < biHeight; i++) { //for each resize factor for (int b = ...
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
87 views

Changing file header- Invalid or unsupported format

I am having problem with changing file header. Specifically: BITMAPINFOHEADER new_bi; fread(&new_bi, sizeof(BITMAPINFOHEADER), 1, inptr); BITMAPFILEHEADER new_bf; fread(&...
0
votes
1answer
55 views

Vertical resizing with fseeks()

I am having a problem with fseek() to move the cursor back for copying line My code is below: int old_padding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4; bi.biWidth *= n; bi.biHeight *...
1
vote
1answer
202 views

pset 4: resize adding in black pixels

Whenever I run my program on small.bmp passing in: $ ./resize 4 small.bmp larger.bmp I end up with this: It seems like the size is correct, but it's adding a black pixel after each line in the ...
0
votes
2answers
46 views

A few question about vertical pixel copying. I am confused

// determine padding for scanlines int infile_padding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4; // iterate over infile's scanlines for (int i = 0; i < i_height; i++) { //adding ...
0
votes
1answer
78 views

resize.c error when checking (spoiler)

Using check50 to ensure my code is correct, I get this strange error in red. Could anyone help me find out what the issue is? :) resize.c and bmp.h exist :) resize.c compiles :) doesn't resize 1x1-...
0
votes
0answers
66 views

pset4 resize.c seems working but not checking

Hello and thanks for reading. I'm having the following problem with resize.c: The resized image looks OK (compared to staff.bmp) The headers are OK: ~/workspace/pset4/resize/ $ ./resize 4 small....
0
votes
1answer
124 views

pset4 resize.c : output matches staff's but colour of square is always grey/white!

I have been working on resize.c(less comfortable) for days (tears hair out). My code is able to resize just fine but the colours of the output image are messed up. I just can't seem to find any ...
1
vote
1answer
121 views

Pset 4: Resize - Where am I going wrong?

I've been working on Resize for a few weeks now and just can't seem to get the vertical replication working. I have to apologise in advance, my code is a mess, has a number of replicated notes, and is ...
0
votes
2answers
112 views

resize.c/pset4 showing runtime error

I'm working o resize.c/pset4 and now when it seems like almost everything is done it's showing a runtime error plse help me figure out what's gone wrong .
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
63 views

Hey guys, i am stuck with resize of pset4

I tried very much in trying to find out where i have been going wrong..i am not able to understand whether what i changed in my header is correct or not..could someone help me with this? #...
0
votes
2answers
55 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
189 views

Pset4 - Resize - Wrong colors

One more "Wrong colors" problem :) I tried to write my code according to Zamyla's pseudo: for each row for each pixel in row write to outfile n times write padding_outfile skip over ...
0
votes
1answer
85 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
589 views

How to debug fseek not working as intended

I am pretty certain that my problem in this problem is my fseek in my vertical resizing for loop. Basically my idea is to print out horizontally resized code once per scan line always, then depending ...
0
votes
1answer
223 views

CS50 : pset4 resize(less comfortable)

I have worked on the code for 6 hour and finally on checking manually these codes are working fine. I have tried both small and large bmp from 1 to 6. It worked. But same is not working in check50. ...
1
vote
1answer
510 views

pset4 resize recopy method

I am blocking on that problem since 1 week, I think that I am not far from the solution but struggling to implement the recopy method, an hint would be nice here ! /** * Copies a BMP piece by piece, ...
0
votes
1answer
57 views

PSET4: Resize not duplicating rows

i'm using the recopy method to try to create the resize program. The program is able to resize the bmp horizontally, but for some reason it will not resize vertically. It would be great if someone ...
-1
votes
1answer
243 views

Help with vertical resize in pset4's resize.c

I know this question's a repeat, but all the other questions had code and I didn't want to look through that as it felt like cheating. The way I understand how to resize vertically is to fwrite the ...
1
vote
1answer
768 views

Pset 4: Resize (more) -- check50 all correct except one

The code I have written for resize checks out visually for all float values (0.0,100.0]. Also, check50 agrees that my code is functioning properly save for one specific case: :) resize.c and bmp.h ...
0
votes
2answers
409 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
1answer
70 views

Wrong colors in resized file

My program resizes the image but the colors are wrong. I'm stuck, can you please help me? /** * Copies a BMP piece by piece, just because. */ #include <stdio.h> #include <stdlib.h> #...
0
votes
1answer
98 views

Pset4 - resize, picture enlarged but pixels jumbled

I am stuck on pset4 resize for several days now and even by consulting previous questions on this problem set I could not find where my code is flawed. The output picture is enlarged correctly but ...
0
votes
1answer
319 views

CS50 pset 4 resize less, resize some but not all

I'm taking the XED course "CS50" and now i'm stuck at pset4. So far i have managed to resize the images footprint and managed to resize one of the given images by a factor of 2 and 4, but with a ...
0
votes
1answer
47 views

PSET4 Resize failing staff check but images appear normal

I've browsed through the other solutions to this problem but I couldn't find why mine code isn't working. I compared my header output to a staff solution and it was the same, as well as the size of ...
0
votes
1answer
63 views

Pset4 resize, jumbled output

i am lost on Pset 4 Resize. It appears that the output file is not really larger and on top of that the pixels seem jumbled. If anyone could point me in the right direction of where I am wrong, would ...
0
votes
2answers
133 views

pset4 Resize - black bars of padding?(not sure how to get rid of them)

First time on this so be gentle. I have been at a standstill on this for hours. Below is my code and I can't seem to find out why these black bars(padding)show up. Any help? #include <stdio.h> #...
0
votes
1answer
61 views

Resize.c is not copying pixels correctly

I have been stuck on this problem for over a week now. I can not seem to get the inner for loops to correctly copy and place the pixels from the infile.bmp to the outfile.bmp. I am able to created the ...
0
votes
1answer
83 views

PSET4(resize-recopy method): Image getting resized but black strips appear in every alternative column. Why?

int initWidth = bi.biWidth; int initHeight = bi.biHeight; int initpadding = (4 - (initWidth * sizeof(RGBTRIPLE)) % 4) % 4; bi.biWidth*=f; bi.biHeight*=f; // determine padding for ...
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
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
194 views

pset4 recopy method Question

/** * Copies a BMP piece by piece, just because. */ #include <stdio.h> #include <stdlib.h> #include "bmp.h" int main(int argc, char *argv[]) { // ensure proper usage if (argc !...
0
votes
1answer
254 views

Resize - Looking for tips / hints on what I'm doing wrong

In my understanding, what I already did was Update the outfile headers Write each row n times. Write each pixel n times. The relevant parts: // calculate outfile info header BITMAPINFOHEADER outBi ...

1
3 4
5
6 7
13