Files
fastfetch/src/logo/image/im6.c
T
Piotr Kubaj 20597bff00 Logo (image): also try unsuffixed ImageMagick library names
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.
2026-09-02 17:06:16 +08:00

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