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

pset4 resize only works if there is no padding

The bmp images looks pretty much alike with the staff's bmp when there is no padding. But when I use a factor of 3, the image shows random colors, even when xxd padding seems to be ok. I also checked ...
0
votes
2answers
676 views

Pset 4 - Premature end of file encountered

On resize.c, my code compiles and runs without any errors. However, the image produced is a broken image. At the top of the viewer is the error message 'Premature end-of-file encountered'. This is my ...
0
votes
1answer
455 views

Padding, pset4, resize. weird xxd output

I have a padding problem in the resize (pset4). I can resize any image that doesnt need padding in their new version, but when it comes to padding it just doesn't work. I checked the headers with peek ...
0
votes
2answers
497 views

Resize.c creates bitmaps with only first few pixels copied

My implementation creates the headers properly (verified with xxd), so I know it's somewhere in this loop that I'm missing something. I've been trying all sorts of variations of this code, but cannot ...
0
votes
1answer
533 views

pset4 - image resizes correctly, but check50 detects some faults

I've been able to resize images correctly (I checked several sizes and images and apparently everything works), but check50 complains saying that it doesn't resize correctly. I think the problem is in ...
0
votes
2answers
785 views

resize vertically doesn't work

First of all I know there are a lot of other questions like this but I have looked at all of them. They have helped a lot but I am still stuck. I can't see anything logically wrong with my code, but ...
0
votes
1answer
2k views

How to Resize an Image Vertically?

I'm able to resize a given .bmp horizontally, but the code for vertical resizing is not working. Here is my code for vertical expansion. // resize vertically //move pointer to start of scanline of ...
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
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
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'...
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
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
24 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
160 views

CS50 - Pset3 - Resize (Less)

Can someone please review this code for Resize Less pset. It seems to me that it is functioning correctly and resizing the images appropriately. However, I am failing all of the checks when is submit ...
0
votes
1answer
192 views

Resize(less) How to store triple into an array?

I have been struggling with resize (less). I can't seem to make sense of how to put the value of triple that is being read into an array (rewrite method) Any help will be appreciated // iterate over ...
0
votes
2answers
63 views

Pset 3 - Resize - header problem

I'm currently working on resize, and I attempted to solve the part about updating the outfile's header info, but I think I messed up somehow. The bi2.biWidth and bi2.biHeight (see my code) get set to ...
0
votes
1answer
62 views

CS50 Pset4 Resize Padding. again

CS50 Pset4 Resize Padding. again I need help! I got lost The code creates a scalable bmp file but is distorted. I think there is a mistake with padding int main(int argc, char* argv[]) { // ...
0
votes
1answer
52 views

Invalid or Unsupported Image Format (Recover)

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

Resize(less comfortable)

I think I'm close but I'm still getting the wrong image each time I try to resize small.bmp to large.bmp. I know it's somewhere in the loops at the end of the code but I'm just not seeing it for some ...
0
votes
1answer
273 views

fread() and fwrite() problem

I've been working on resize.c and after a long time of hard work. I completed it but I wasn't able to understand that Whenever I use fwrite(&triple, sizeof(RGBTriple), atoiargv[1], outptr); ...
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
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
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
2answers
88 views

Segmentation fault in resize.c

I'm trying to check that the third command line is a digit so I did int n; if (!isdigit(argv[3])) { fprintf(stderr, "n MUST be a number"); return 4; } else { n = ...
0
votes
1answer
263 views

Having trouble with PSet4 resize problem

I'm having difficulty with PSet4's resize problem right now. I feel like I've implemented it correctly, but the result is a colour-mish-mash which ends half way through the file. My solution was to ...
0
votes
1answer
70 views

ps4 resize error

I'd been starting at this for hours and can't figure out what I'm doing wrong. To scale for the horizontal I put fwrite() in a for loop repeating n times for each pixel. To scale vertically I put the ...
0
votes
2answers
233 views

biHeight strange value pset4

when I run the peek on small.bmp or other the biHeight is fffffff4 I did printf on the height in the copy.c and it printed: 4294967284 What am I missing here?
0
votes
1answer
57 views

Odd IDE behavior during pset4

I just finished writing the code for the resize problem of pset4. When I run my code in the debugger, everything turns out right, but when I run it simply in the terminal, the computer complains about ...
0
votes
1answer
671 views

getting runtime error: unsigned integer overflow

#include <stdio.h> #include <stdlib.h> #include "bmp.h" int main(int argc, char* argv[]) { // ensure proper usage if (argc != 4) { printf("Usage: ./copy n infile ...
0
votes
1answer
37 views

Trouble with padding in resize

My code for resize works unless the file I'm resizing requires padding. For the life of me I can't figure out what I'm doing wrong. I've been messing around in gdb for hours. Help and explanations ...
0
votes
1answer
163 views

pset4: File operations using fwrite(arguments)

I'm writing the code for resizing the image . I have an issue while using the fwrite function. fwrite( const void *buffer, size_t size, size_t count, FILE *stream ); From what I understand the ...
0
votes
1answer
362 views

Why is resize not passing check 50?

Resize.c is by far the most difficult code for me this far... I have asked the question before and was told to work on my padding which I did and I think it´s good now. But check50 still says this :) ...
0
votes
1answer
73 views

Resize problem(File indicator pointer)

I have check with the CS50 peek and all are green lit. The BMP on the other hands just shows the original (colours x n) and the rest of the picture is just green. I have read something about File ...
0
votes
1answer
177 views

Resize: color randomization

I am working on resize for PSET4, and more specifically I'm at the point of working out the horizontal resizing (in other words, don't look for the vertical resizing, it's not even started yet). I can ...
0
votes
1answer
206 views

Pset4 - resize : stuck in resizing vertically (Yes, i have read other q&a regarding this topic, but still can't figure out the solution)

I don't understand why my code doesn't work the way i expected it, i believe my mistake is in understanding fseek. please help me with some advice int scanline = 0; int horiz = 0; for(int i = 0, ...
0
votes
2answers
226 views

pset4 Resize: Don't understand problems with size and dimensions

After digging to implement resize, I don't get it if issues come from resize vertical, horizontal or even padding. By running my program on peek, this is what display (* highlighted difference between ...
0
votes
1answer
383 views

pset4 Resize adding padding... and resize in general (HELP ME!)

I'm having a really hard time grasping pset4, I think I've changed the header files correctly but I'm not sure.. I feel like this pset is WAAAY harder than the last. I still barely understand a lot of ...
0
votes
1answer
61 views

Pset4 resize: Everything should be working, but it doesn´t

Help please! I don't know what is wrong, yet the output file is an exact copy of the input file :C #include <stdio.h> #include <stdlib.h> #include "bmp.h" int main(int argc, char* argv[])...
0
votes
1answer
136 views

Want to make sure I understand struct, malloc, and pointers and how they relate to each other

Sort of related to PSET4 resize, but actually want to make sure I understand this in general. So at first I just declared a struct BITMAPINFOHEADER called "new_bi" and dealt with it while avoiding ...
0
votes
1answer
361 views

Resize What to do next?

/** * copy.c * * Computer Science 50 * Problem Set 4 * * Copies a BMP piece by piece, just because. */ include include include "bmp.h" int main(int argc, char* argv[]) { // ensure ...
0
votes
1answer
434 views

PS4 Resize makes random colors

So, I'm in the midst of PS4 resize, and while I know I'm still figuring out an array of different things, when i currently perform the resize (even if I "resize" it to the same size) it seems to be ...
0
votes
1answer
332 views

Check50 calls errors with resize

My resize does the work pretty well with the smiley.bmp and small.bmp. Although it fails to pass check50. I've checked my program so many times, the headers are the same as the stuff implementation, ...
0
votes
1answer
756 views

what is the problem with my resize?

I'm having trouble making getting resize to work correctly even though I spent so much on it. I feel it's somewhere in the for loop where I'm storing the RGBTRIPLE in current_row. Here's my code: ...
0
votes
1answer
100 views

Check50 reports all tests after not resizing 1X1 bitmap with n = 1 fail despite header and image pixels being correct

Code: /** * copy.c * * Computer Science 50 * Problem Set 4 * * Copies a BMP piece by piece, just because. */ #include <stdio.h> #include <stdlib.h> #include "bmp.h" int main(...
0
votes
1answer
218 views

Bitmap file size

which field in BITMAPFILEHEADER & BITMAPINFOHEADER represents the size of the image? whether it is bfSize of BITMAPFILEHEADER or biSizeImage of BITMAPINFOHEADER as in the specification at https://...
0
votes
1answer
82 views

Resize only works when n % 4 = 0, when n = 1 or when i resize a 2x2-pixel BMP and n =2

I don't know exactly where is the problem. Resize gives me a bunch of different colors when n % 4 !=0. Can you guys help me understand what I'm doing wrong? // iterate over infile's scanlines { //...
0
votes
1answer
2k views

Need Help in pset 4 resize. CAN'T understand what's wrong

#include <stdio.h> #include <stdlib.h> #include "bmp.h" int main(int argc, char* argv[]) { // ensure proper usage if (argc != 4) { printf("Usage: ./resize n infile ...
0
votes
1answer
606 views

Resize.c not working in some cases

I'm struggling with resize.c for quite some time. I've come to the point where it perfectly resizes sometimes (for example, small.bmp with factor 5) but sometimes it doesnt(for example, small.bmp with ...
0
votes
1answer
434 views

resize vertically is not working properly

i take the re-copy approach guys and badly stuck in that problem .. everything my code is fine just writing pixel is wrong somewhere. i'm posting my writing snippet of my resize please give me some ...
0
votes
1answer
522 views

"Unsupported file format" error when checking the format of BMP files

pset5 is the first pset so far that I've really struggled to understand. I've written the code, but I can't test the algorithms because everytime I run it I get "Unsupported file format" // ensure ...

1 2
3
4 5
13