diff --git a/README.md b/README.md index 54d51b7ec..17c17b890 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,15 @@ AlmaLinux, Alpine, Android, Arch, Arco, Artix, Bedrock, CachyOS, CentOS, CRUX, C * Some logos have an old variant. Access it by appending _old to the logo name. * To disable the logo, use `--logo none`. * Get a list of all available logos with `fastfetch --print-logos`. -* Printing images as logo is supported using Sixel / Kitty / iTerm graphics protocol or chafas image to text conversion. + +###### Image logo + +Printing images as logo is supported using Sixel / Kitty / iTerm graphics protocol or chafas image to text conversion. + +* Sixel: fastfetch must be built with imagemagick support to convert image to sixel format +* Kitty: Because [kitty support png](https://sw.kovidgoyal.net/kitty/graphics-protocol/#png-data) natively, using `png` image file with both `--logo-width` and `--logo-height` being specified is recommanded to get maximum performance. Otherwise, imagemagick is required to convert image to RGBA data. +* iTerm: [Since iTerm supports a lot of image format](https://iterm2.com/documentation-images.html), imagemagick support is not required. However, both `--logo-width` and `--logo-height` must be specified since fastfetch has no idea about the size of the image. +* Chafa: Requires imagemagick support. ##### Package managers ``` diff --git a/src/logo/image/image.c b/src/logo/image/image.c index aed67ca6a..ed0f0677f 100644 --- a/src/logo/image/image.c +++ b/src/logo/image/image.c @@ -30,12 +30,18 @@ static FFstrbuf base64Encode(FFstrbuf* in) static bool printImageIterm(FFinstance* instance) { if(instance->config.logo.width == 0 || instance->config.logo.height == 0) + { + fputs("Logo: `item` protocol only works when both `--logo-width` and `--logo-height` being specified\n", stderr); return false; + } FFstrbuf buf; ffStrbufInit(&buf); if(!ffAppendFileBuffer(instance->config.logo.source.chars, &buf)) + { + fputs("Logo: failed to load image file\n", stderr); return false; + } ffPrintCharTimes(' ', instance->config.logo.paddingLeft); FFstrbuf base64 = base64Encode(&buf);