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).

106 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
1answer
178 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 ...
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....
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 ...
1
vote
1answer
465 views

Looking for clarification on PSET4 Resize - “Rewrite” method

Can I request for some help on my resize.c pset? I'm trying to do the "rewrite" method as per the pset's walkthrough. The pseudocode is as follows: 1 for each row 2 for each pixel 3 write ...
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 ...
1
vote
0answers
209 views

pset5: Resize does not consistently work

I am having a problem with resize. I can resize smiley.bmp perfectly at X1, X2, and X10, but not for factors between 2 and 10--I just get an abstract blob of colors. I assume this has something to do ...
1
vote
3answers
421 views

pset5 resize working (IMO) but check50 says it's not

I'm having a bit of an issue here.. I wrote the resize.c function for pset5 and it is working - I am getting the expected results - I can see my file being resized and it looks alright in image ...
1
vote
1answer
190 views

Resizing small.bmp with n=4 gives an image with a black rectangle on the bottom left corner

When I try my resize program on small.bmp and enter 4 as n, it gives me a 12x12 picture that is all green, but instead of having the white little square in the middle it has a black rectangle on the ...
1
vote
1answer
510 views

adding padding into resize

I know my paddingOld & paddingNew values are correct. I also know all my header info is correct (checked student vs staff) check 50 passes the cases that do not need padding, but fails the ones ...
1
vote
1answer
375 views

pset 5 resize.cdoes not resize properly. works visually for smiley.bmp but not for small.bmp

Theses are my observations so far: It can resize the smiley.bmp properly without distorting the image. What I'm not sure about is whether or not the contents of its headers are right. It can resize ...
0
votes
0answers
36 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&...
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
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
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
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
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
0answers
105 views

PSET3 Resize -resizes correctly Byte… doesn't match

I don't understand what I did wrong... Here's my code : // Copies a BMP file #include <stdio.h> #include <stdlib.h> #include "bmp.h" int main(int argc, char *argv[]) { int 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
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
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
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
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
132 views

Resize horizontal scaling

I am really racking my brain over this. I'm trying to implement horizontal scaling for resize but all I'm getting are grey and white boxes. int main(int argc, char *argv[]) { // ensure proper usage ...
0
votes
0answers
92 views

Problem in pset4 Resize

I am trying to solve pset4/resize.c I have been spending hours on trying to determine the mistake. Here is the code: // Copies a BMP file #include <stdio.h> #include <stdlib.h> #...
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
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
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
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
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
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
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
0answers
95 views

pset 4 Resize - expand vertically

/** * Copies a BMP piece by piece, and increase by factor of n */ include include include "bmp.h" int main(int argc, char *argv[]) { // ensure proper usage if (argc != 4) { ...
0
votes
0answers
74 views

Is resize.c/more functionality for n < 1 subjective?

I am having issues with getting my outfiles for n = 0.5 to match check50's. To scale a bitmap image down pixels must be removed, and the algorithm we're required to write is what will choose which ...
0
votes
1answer
121 views

Pset4 Resize (less) help

I'm stuck on resize. I feel like i'm doing everything right but have no idea why my code isn't working right. I think i'm pretty close but the vertical scaling isn't working as it should it seems. ...
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
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
0answers
30 views

Resize does not compile

I wrote the code for Resize, saved it and compiled it. But it does not compile. Instead, it gives a super long error message. ~/workspace/pset4/resize/ $ make resize clang -fsanitize=integer -...
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
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
0answers
139 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 ...
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
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
82 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
0answers
64 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
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
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
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
2answers
128 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
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. ...