README: document image logo support

This commit is contained in:
李通洲
2023-01-01 12:29:08 +08:00
parent 90bb004940
commit 9f93ca8019
2 changed files with 15 additions and 1 deletions
+9 -1
View File
@@ -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
```
+6
View File
@@ -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);