mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 09:58:03 +02:00
20597bff00
FreeBSD (and other systems that build ImageMagick without encoding the quantum depth into the library name) install libMagickCore-7.so and libMagickCore-6.so without a .Q16HDRI / .Q16 suffix. dlopen currently only tries the suffixed names, so image logos always fall back to ASCII art with "Image Magick library not found" even when ImageMagick is installed. Append the plain library names as a last resort.
34 lines
1.2 KiB
C
34 lines
1.2 KiB
C
#ifdef FF_HAVE_IMAGEMAGICK6
|
|
|
|
#include "image.h"
|
|
#include "common/library.h"
|
|
|
|
#include <magick/MagickCore.h>
|
|
|
|
static FF_LIBRARY_SYMBOL(ResizeImage)
|
|
|
|
static void* logoResize(const void* image, size_t width, size_t height, void* exceptionInfo) {
|
|
return ffResizeImage(image, width, height, UndefinedFilter, 1.0, exceptionInfo);
|
|
}
|
|
|
|
FFLogoImageResult ffLogoPrintImageIM6(FFLogoRequestData* requestData) {
|
|
// clang-format off
|
|
FF_LIBRARY_LOAD(imageMagick, FF_LOGO_IMAGE_RESULT_INIT_ERROR,
|
|
"libMagickCore-6.Q16HDRI" FF_LIBRARY_EXTENSION, 8,
|
|
"libMagickCore-6.Q16" FF_LIBRARY_EXTENSION, 8,
|
|
"libMagickCore-6" FF_LIBRARY_EXTENSION, 8
|
|
)
|
|
// clang-format on
|
|
FF_LIBRARY_LOAD_SYMBOL_ADDRESS(imageMagick, ffResizeImage, ResizeImage, FF_LOGO_IMAGE_RESULT_INIT_ERROR)
|
|
|
|
FFLogoImageResult result = ffLogoPrintImageImpl(requestData, &(FFIMData) {
|
|
.resizeFunc = logoResize,
|
|
.library = imageMagick,
|
|
});
|
|
|
|
imageMagick = nullptr; // leak imageMagick to prevent fastfetch from crashing #552
|
|
return result;
|
|
}
|
|
|
|
#endif
|