0

guys i don't understand what is wrong with my code : http://pastebin.com/xbjCYNCX i am trying to copy the pixels to a 2-d pinter array of structures, skipping the padding and then write it to the outfile.please help

0

There are many issues in your code, but I'll just point out the main ones.

  1. You don't check if n is less than 1 or if n is greater than 100. This will cause some check50 errors. A simple if statement will fix the problem.

  2. You don't declare an old padding or new variables. This is very important because you must skip over the old padding in order to properly resize the image. I suggest that you make new variables for your new padding, new size image, new biWidth, etc. Then, you can keep the values of the old variables for the old padding. You'll have to adjust your code to allow for the new variables. The new variables will also help in other aspects of your code. For your for loop statements, you want to iterate the absolute height of the old biWidth. Because you changed the value of biWidth, this'll mess up your resizing process.

  3. Your for loops have serious issues. You need to take a long look at your for loops and rethink the process. In order to resize correctly, you have to resize over the infile's scanlines as well as the pixels in the scanline, which calls for two for loops.

There are smaller errors in your code, but I hope that these main ones will push you in the right direction. If you still have errors, please comment below. I'd be happy to take a more thorough look through your code and walk you through the debugging process. If this answers your question, please hit the green checkmark! It helps a lot. :-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .