opening image file on c++ , PNG , JPEG [closed]

This:

ifstream image("bg.png");

… opens the file in text mode, where, in Windows and on old Macs, certain byte sequences denoting end-of-line and end-of-text, are changed on input and output.

You don’t want that.

Specify binary mode.


That said, the closest you get to “standard” image handling in C++ is the Boost Image library.

Leave a Comment