Проблема с загрузкой изображения из файла в Windows с использованием библиотеки libjpeg-turbo

Пытаюсь открыть JPEG-изображение с помощью библиотеки libjpeg-turbo для чтения следующим образом:

struct jpeg_error_mgr err;
struct jpeg_decompress_struct info;
info.err = jpeg_std_error(&err);
jpeg_create_decompress(&info);
 
string filename("image01.jpg");
FILE* file = fopen(filename.c_str(), "rb");
 
if (file)
{
    jpeg_stdio_src(&info, imageFile);
    jpeg_read_header(&info, TRUE);
    jpeg_start_decompress(&info);
}

Но при дебаге обнаружилось, что результат выполнения jpeg_stdio_src является некорректным (файл существует в одной папке с исполняемым файлом и имеет именно это имя). На официальном сайте библиотеки написано следующее:

libjpeg-turbo 2.1.x and later

- If your application uses the libjpeg API (as opposed to the TurboJPEG API) and you plan to dynamically link with jpeg62.dll (the
libjpeg API DLL in the official libjpeg-turbo packages for Visual C++), then you will need to install the Visual C++ 2015-2019
Redistributable Package (x86, x64) if it isn't already installed.

- Features of the libjpeg API that require passing a C run-time structure, such as a file handle, from an application to the library
will probably not work with jpeg62.dll, unless the application is also built to use the Visual C++ 2015-2019 C run-time DLL. In
particular, this affects jpeg_stdio_dest() and jpeg_stdio_src().

- Applications built with Visual C++ 2013 or earlier must link with jpeg62.dll or turbojpeg.dll. They cannot be linked with the official
libjpeg-turbo static libraries (jpeg-static.lib and turbojpeg-static.lib), due to backward incompatibilities in the Visual C++ 2015-
2019 run-time libraries.

Я использую Visual Studio 2019 и не понимаю, в чем у меня проблема и как её исправить. В сети предлагают использовать jpeg_mem_src, но там проблемы с размером начинаются даже на изображениях 100х100 пикселов.

P.S.: требуется использовать именно libjpeg-turbo либо "чистый" ijg jpeg.


Ответы (0 шт):