Every time I try to compile my code to check grayscale, I put in the input they gave in the instructions:

./filter -g infile.bmp outfile.bmp

But I keep getting this message saying Could not open infile.bmp. How do I compile this to check it?

what is the error

  • The issue is probable in the command line. What is the name of the file you are trying to open? because your program is trying to open a file named infield.bmp
    – Chris
    Commented May 23, 2020 at 22:16

1 Answer 1


That's simple because infile.bmp does not exist, that is just a placeholder it means that, that the path you put in there should contain a file. The folder images has images where you could process or filter. Try doing ./filter -g images/tower.bmp images/greytower.bmp. This basically means ./filter will run your program, -g will state that you want to use the grayscale function, images/tower.bmp is the path where the file you want to filter will be, then images/greytower.bmp is the path and the filename you want to place the filtered image. if you run that you should see in your images folder a file called greytower.bmp, and if your code is correct then if you view the image it should be grayscaled.

You must log in to answer this question.

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