Skip to content

Commit

Permalink
chafa: Fix transparency issue with some SVG images.
Browse files Browse the repository at this point in the history
SVG images with white paths on a transparent background were being
interpreted as white-on-white by ImageMagick. By explicitly
setting the background color to "none", we get a transparent background
by default.

Thanks to nemo who posted this fix as a comment on my blog:
https://hpjansson.org/blag/2019/01/07/the-worst-ansi-renderer-except-for-all-the-others/#comment-348
  • Loading branch information
hpjansson committed Jul 22, 2019
1 parent 7f2cb3f commit ebae1a6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tools/chafa/chafa.c
Expand Up @@ -1071,10 +1071,18 @@ run_magickwand (const gchar *filename, gboolean is_first_file, gboolean is_first
xwd_loader = xwd_loader_new_from_mapping (file_mapping);
if (!xwd_loader)
{
PixelWand *color;

file_mapping_destroy (file_mapping);
file_mapping = NULL;

wand = NewMagickWand();
wand = NewMagickWand ();

color = NewPixelWand ();
PixelSetColor (color, "none");
MagickSetBackgroundColor (wand, color);
DestroyPixelWand (color);

if (MagickReadImage (wand, filename) < 1)
{
gchar *error_str = NULL;
Expand Down

0 comments on commit ebae1a6

Please sign in to comment.