Questions tagged [bmp]
The bmp tag has no usage guidance.
35 questions
0
votes
1
answer
5k
views
2019 CS50 PSet 4 Filter Less
https://cs50.harvard.edu/college/psets/4/filter/less/
I'm so lost I don't really know where to begin. The last exercise plurality with the distributive code was a nightmare, I only found one other ...
0
votes
0
answers
39
views
I don't understand how to change header info and how it is implemented
I don't understand how the new image will implement new data i imput in like new_biWidth or new_biheigh. I added this new variables in bmp.h and I asigned to them same tipes of data like the old ones. ...
0
votes
1
answer
84
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
1
answer
38
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
vote
1
answer
73
views
nothing can be done for whodunit. Even though I have my bmp.h file still it shows me that the file doesn't exist. help me out
whodunit.c:6:10: fatal error: 'bmp.h' file not found
include "bmp.h"
1 error generated.
0
votes
1
answer
422
views
determine padding for scanlines in copy.c
Line 65 in copy.c
int padding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4;
Question is why do we need last modulo operator in bold?
Even without it, it gives the right answer.
0
votes
1
answer
130
views
Problem interpreting BMP file structure
I first ran xxd -c 36 -g 3 large.bmp and got the underlying binary file.
For this question, I will reproduce the first line (36 bytes)
424de6 010000 000000 003600 000028 000000 0c0000 00f4ff ffff01 ...
0
votes
1
answer
265
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 ...
1
vote
1
answer
104
views
Pset 4 Resize makes a very colorful picture (not green!)--padding problem?
Well, it looks like I'm not the only one having issues with padding (I suspect that's my problem).
Specifically, if I test my version of resize with an enlargement factor of 2 (using small.bmp as ...
0
votes
1
answer
62
views
Resize Adding Too Much Padding
I'm really struggling with resize on pset4. My loop is adding too much padding, I think by a factor of the scale. I'm still working on the horizontal stretch portion of the program. I'm pretty sure ...
0
votes
1
answer
59
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
1
answer
79
views
PLEASE HELP!! cs50 pset4 resize.C complies but cannot resize 1x1 correctly. ,AND large.bmp says"invalid image or format"
Here's the code I finally have.
but the issue is the cs50 check says :
:) resize.c and bmp.h exist
:) resize.c compiles
:( doesn't resize 1x1-pixel BMP when n is 1
:( resizes 1x1-pixel BMP to 2x2 ...
1
vote
1
answer
2k
views
pset4 resize, invalid or unsupported image format
I've looked up previous questions and seen people have also tended to change bfSize as well, but when I did this the image was still unsupported so I changed it back. As such nothing in ...
0
votes
2
answers
59
views
can't pass check50
My code works correctly. large creates and correctly. but it simply won't pass check50
/**
* copy.c
*
* Computer Science 50
* Problem Set 4
*
* Copies a BMP piece by piece, just because.
*/
#...
0
votes
1
answer
605
views
pset4 resize: how to copy a row
Just spent 2 days for figuring out how fread(), fwrite() and fseek() works.
I tried to use "Rewrite" method from Zamyla's video for vertycal resizing:
- Remember pixels in array (first written row of ...
0
votes
1
answer
494
views
pset4 malloc() approach. Help with size of buffer
I'm having some trouble with the malloc function.
I want to make a buffer the size of the new row I'm going to write in the resized file, and this is my approach.
I must say that bi.biWidth is ...
0
votes
1
answer
118
views
pset 4, resize.c is not working
Here is the code for resize.c I am stuck for quite some time now and i am not able to figure out where i am wrong. please help.
bi.biHeight = height*n;
bi.biWidth = width*n;
// determine new padding ...
2
votes
2
answers
5k
views
Why is RGBTRIPLE in our bitmap 3 bytes? Is that defined somewhere?
This question was asked in the comments of another question, and I think it's a good question, but I wanted to make sure this was addressed in the proper place:
How do I know RGB triple is 3 bytes? ...
0
votes
1
answer
246
views
Pset4 Resize Error
When I try to run the program, I get the message "file size limit exceeded." After looking over my code many times, I can't figure out what might be going wrong??
/**
* copy.c
*
* Computer Science 50
...
0
votes
1
answer
145
views
pset4 resize premature end of file encountered
This is extremely frustrating. I've been having header problems for a while, getting various error messages. However, using xxd I can see that when I run resize with n=2, biSizeImage is indeed 120, ...
0
votes
1
answer
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
1
answer
733
views
pset4 - resize.c - Cannot get vertical resizing to work
and thanks for helping me with my problem. I have managed to get horizontal resizing to work within my resizing program, but every time I attempt the next step, I keep failing. Here is the code of the ...
2
votes
2
answers
607
views
Pset4: How does fread add properly to the struct?
In Problem Set 4 we're given the copy.c and bmp.h files. On line 47 the fread() function is called with the arguments, &bf, sizeof(BITMAPFILEHEADER), 1, and inptr. I understand what each of these ...
0
votes
1
answer
112
views
Resize not working (writes RGBTRIPLE too many times)
In resize.c, the image created in my resized image is a tiny image with a black blotch in the middle, regardless of whether I use small.bmp or smiley.bmp as input.
When I run xxd, the header in the ...
0
votes
1
answer
98
views
Why is biSizeImage a random number?
I found this anomaly when running peek, then confirmed with gdb that bi.biSizeImage is getting set to 4294966864 when it should be 432.
0
votes
1
answer
587
views
biWidth x biHeight x bytes per pixel != biSizeImage
The data is from clue.gmb run by copy
Why is biSizeImage and bfSize 2 bytes larger than expected? Is this an inherent property of bitmap images that I'm not aware of, or is something else going on? ...
0
votes
1
answer
517
views
resize pset 4 confused on number of things
I think I have the headers correct except for the new bf.Size not to sure on that one. I am having real problems with resizing the bitmap and I can't figure out what it is, any hints or pointers in ...
3
votes
1
answer
1k
views
PSET 4: Why is padding required?
I am currently going through the PSET 4 sheet and have just read up to the part where it is being explained that if the number of bytes in each scan line is not a multiple of 4 then it is padded out. ...
1
vote
2
answers
729
views
How to create a BMP image that is compatible with resize?
Using my resize on small.bmp and smiley.bmp then with cs50's peek, I get the exact same values as with the staff's solution for BITMAPFILEHEADER and BITMAPINFOHEADER (I tested with different n values)....
1
vote
2
answers
3k
views
How to interpret biHeight data
I am having trouble with biHeight from the header info of bmp files.
In the file small.bmp, from pset5, that is 3X3 pixels: biHeight has the value fffffffd. I would expect it to be the same as the ...
1
vote
1
answer
553
views
fseek in pset4(whodunit)
everyone, this is a segment of the code from pset4(whodunit) copy.c, and I'm wondering why the function fseek is needed. Given that padding cannot be read by fread, why not just simply use fputc to ...
1
vote
1
answer
935
views
what is wrong with my resize?
My resize program isn't working. I have narrowed it down to the padding, but cannot find what is incorrect.
It resizes images that don't need padding perfectly (multiples of 4), and the header ...
1
vote
0
answers
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 ...
2
votes
1
answer
103
views
Why should we assume that the size of the output BMP file does not exceed 4 GB?
Per the spec of pset5,
You’re welcome to get started by copying (yet again) copy.c and naming
the copy resize.c. But spend some time thinking about what it means to
resize a BMP. (You may ...
0
votes
1
answer
183
views
pset5 resize, not enough memory to load bmp
Resize is compiling but the outfile bmp doesn't open. It gives me an error "Not enough memory to load bmp". Does anybody have any idea why that might be happening? Where am I going wrong? Here's my ...