Skip to content

Commit

Permalink
fix: Respect EXIF rotate flag (#1568)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitry-ishenko authored Sep 19, 2024
1 parent 98dba38 commit 6284b36
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/modules/image/util/image_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ std::shared_ptr<FIBITMAP> load_image(const std::wstring& filename)
CASPAR_THROW_EXCEPTION(invalid_argument() << msg_info("Unsupported image format."));

#ifdef WIN32
auto bitmap = std::shared_ptr<FIBITMAP>(FreeImage_LoadU(fif, filename.c_str(), 0), FreeImage_Unload);
auto bitmap = std::shared_ptr<FIBITMAP>(FreeImage_LoadU(fif, filename.c_str(), JPEG_EXIFROTATE), FreeImage_Unload);
#else
auto bitmap = std::shared_ptr<FIBITMAP>(FreeImage_Load(fif, u8(filename).c_str(), 0), FreeImage_Unload);
auto bitmap = std::shared_ptr<FIBITMAP>(FreeImage_Load(fif, u8(filename).c_str(), JPEG_EXIFROTATE), FreeImage_Unload);
#endif

if (FreeImage_GetBPP(bitmap.get()) != 32) {
Expand All @@ -94,7 +94,7 @@ std::shared_ptr<FIBITMAP> load_png_from_memory(const void* memory_location, size
auto memory = std::unique_ptr<FIMEMORY, decltype(&FreeImage_CloseMemory)>(
FreeImage_OpenMemory(static_cast<BYTE*>(const_cast<void*>(memory_location)), static_cast<DWORD>(size)),
FreeImage_CloseMemory);
auto bitmap = std::shared_ptr<FIBITMAP>(FreeImage_LoadFromMemory(fif, memory.get(), 0), FreeImage_Unload);
auto bitmap = std::shared_ptr<FIBITMAP>(FreeImage_LoadFromMemory(fif, memory.get(), JPEG_EXIFROTATE), FreeImage_Unload);

if (FreeImage_GetBPP(bitmap.get()) != 32) {
bitmap = std::shared_ptr<FIBITMAP>(FreeImage_ConvertTo32Bits(bitmap.get()), FreeImage_Unload);
Expand Down

0 comments on commit 6284b36

Please sign in to comment.