My code (see gist) is almost functional, but it doesn’t fully copy the white pixels. Here’s the comparison:
Small
Resized
Any hints would be really appreciated. Thanks!
My code (see gist) is almost functional, but it doesn’t fully copy the white pixels. Here’s the comparison:
Small
Resized
Any hints would be really appreciated. Thanks!
I think you’re “overreading” the triples from the infile.
Have you watched the walkthrough yet?
Hello!
Yes, I already watched the walkthrough a couple of times. And the material is still going wayyyy over my head
I think you’re “overreading” the triples from the infile.
...
RGBTRIPLE triple;
fread(&triple, sizeof(RGBTRIPLE), 1, inptr);
// Write each pixel "scale" times.
for (int z = 0; z < scale; z++)
{
fwrite(&triple, sizeof(RGBTRIPLE), 1, outptr);
}
How do I fix it then? As I’m looking at it, I don’t think I’m overreading the triples because I’m not freading
it scale
times (unlike fwrite
). Please do enlighten me
You’re reading more scanlines from the infile than it has, because it only has r
rows, but you’re really reading r * scale
rows (the code that reads from the infile is in the loop that writes each row “scale” times).