Having the SVG stroke go on the outside should be easy, right? Right?

My go-to tool to generate images (with text overlays and stuff) is svg.el in Emacs. It provides a convenient interface for making SVG files, and then I can just convert it to something else for display. The thing I’ve been using it for lately is to display actor names in movies I’m watching.

Which brings me to what I’m yammering about today — adding outlines to text. Because if you’re displaying text over random (moving) pictures, you have to add an outline so that you can read the text.

The normal way to do that in SVG is to specify a stroke-width. But as you can see, that’s ugly — the stroke is inside the letter shapes, effectively shrinking the shapes down and making them spindly and awkward.

Perhaps easier to see if you really exaggerate the width.

So the obvious question is: Can you specify that the stroke goes on the outside of the shape instead of the inside?

And:

Yes, very amusing. The quibbles are kinda quibbly:

Etc. So: Nope.

But of course it is possible to add an outline to a shape — you can do that perfectly in HTML/CSS with borders and stuff, so instead SVG has grown filters. Look how simple:

<svg width="900" height="200" viewBox="100 0 900 200">
    <filter id="outline">
        <feMorphology in="SourceAlpha" result="DILATED" operator="dilate" radius="4"></feMorphology>
        
        <feFlood flood-color="#32DFEC" flood-opacity="1" result="PINK"></feFlood>
        <feComposite in="PINK" in2="DILATED" operator="in" result="OUTLINE"></feComposite>

        <feMerge>
            <feMergeNode in="OUTLINE" />
            <feMergeNode in="SourceGraphic" />
        </feMerge>
    </filter>

    <!-- DILATED TEXT -->
    <text font-size="85px" dx="125" dy="130" font-weight="700" filter="url(#outline)">upgrade yourself</text>
</svg>

Which reminds me of this classic:

I think the SVG people did, really.

But it does work:

See? Erhm… Hm. That looks a bit odd… let’s up the outline radius:

BY ALL THAT”S UNHOLY!!! OK, I’ve converted the SVG to JPEG using ImageMagick, and its SVG support is a bit, er, funny. Let’s look at it in Firefox:

Yeah, that looks OK?

Let’s see… what about rsvg-convert?

Well, that’s fine, isn’t it? So you need pretty a pretty recent SVG toolchain for this to work, I guess.

I wonder what happens if I up the outline radius ridiculously…

It’s a bit brutal…

A 0.5 opacity looks OK, I guess…

Anyway. That’s the rant for today: We can never have good things.

Book Club 2025: A College of Magics by Caroline Stevermer

I bought this because Lois Macmaster Bujold told us to:

And I think I’m coming down with a cold, so a fun fantasy book sounds like just the thing.

(Amusingly enough, the cover says that it’s better than Harry Potter. But this book was originally published in 1994, which I guess means that the publisher rushed out new editions of anything vaguely resembling Harry Potter to capitalise on the Harry Potter success.)

First of all, I’m surprised at how the big the type is. And indeed:

They’ve embiggened the font so that they can have a 480 page book instead of a 380 page book, because by this edition, only huge fantasy books sell.

But is it any good? It’s a frustrating book.

Stevermer is quite good at dialogue. So you get tons and tons of scenes of people talking wittily to each other, and these scenes work quite well, even though the actual jokes often make you go “er… wat?” Stevermer isn’t good at anything else, really. The world building is super duper thin. The book is supposed to be set in an alternate 1910 where magic is a thing, but virtually everything we encounter seems like it’s either from the 1700s or is medieval — it’s like the author hasn’t pictured the surroundings at all.

Even worse is that the author doesn’t seem to plan anything at all. I don’t think there’s a single plot element that’s planned in advance. Instead we get scenes like this, where just before Our Heroine needs to magically unlock a door, we’re told that her friend had tried to do the same earlier.

Which makes for a bewildering reading experience. Things just happen, and then another thing happens, and then another, and that’s the way for 480 pages.

Yeah, that’s pretty much it.

A College of Magics (1994) by Caroline Stevermer (buy used, 3.71 on Goodreads)

Ill-Advised Musings On LLMs

I’ve got a cold, so I’ve been idly sitting around doing some slightly more thorough testing of my Emacs/mpv setup for asking LLMs what actor is on the screen of the movie I’m watching, and it’s led to me pondering just why some people are so (literally) incredibly enthusiastic about LLMs.

I mean, LLMs are fun. And useful for doing tedious programming things — for instance, the other day I asked ChatGPT to transform a li’l 150 line Javascript thing from Jquery to pure Javascript — and it did it flawlessly. (And also badly, engineering wise, since it did pointless stylistic changes on just about every line.) That would have been boring to do myself, so it’s nice that there’s a tool for that now.

But non-programming things? I just don’t understand the enthusiasm, because whenever I try to use an LLM for something, it’s never more than a toy. Somewhat useful toy, sure, but you can’t say in any way that it actually, like, works.

I wonder whether the enthusiasm is paradoxically based on how bad LLMs are in general. That is, when you chat with one of those things, it’ll give you the wrong answer a lot of the time, but then you say “but that’s not right”, and it’ll say “Good catch! You’re so smart! I’ve never seen anybody be that smart before; you must be a genius!” or variations thereof, depending on how high the company in question has dialled the knob that’s marked “Ass-Kissing” in the LLM console.

It’s just hard to be mad at a technology that’s consistently stupider than you are, and that always confirms your secret suspicion that you’re really, really smart yourself.

So I’m testing the same screenshot repeatedly with the same LLM (Gemini-2.5-Flash here) to try to see just what level of bullshit it’s giving me. This is Keanu Reeves from Even Cowgirls Get The Blues, and while he does look kinda untypical here, I think if you give somebody a cast list and ask who it is, I don’t think it’s that hard to pick him out as the most likely candidate.

But Gemini isn’t better than a throw of the dice here, even though I’ve tried in many ways to instruct it “if you don’t know, don’t guess”.

It even guesses correctly some of the time.

But let’s try some other movies…

It gets Dakota Johnson correct (from the cinematic masterpiece Madame Web).

Always.

This, from Dune Part Two, doesn’t seem right? Actually, I forget his name now… Oh, yeah, Dave Bautista.

No. So is it really just going through the list of cast members and picking one at random? What if I don’t tell the LLM what movie the screenshot is from…

Nope, makes no difference. It picked a guy from a different Dune movie, though?

It gets Timothée right — always, whether I tell it the movie or not.

Well, it’s not a totally bad guess — they aren’t totally dissimilar. (It’s Bill Pullman from Lost Highway, though.)

Yeah, if I tell it the movie, it gets it right.

Nnnnno.

So, once again, when I try to use an LLM for something, the result is somewhat useful — it’s better than nothing, but you can’t rely on it at all.

And people want to use these things to process social security applications and stuff.

Amazon apparently has a thing for letting you know who’s on screen (called “X-Ray”), and according to rumours, it’s based on hiring people in low-cost countries to tag every scene with the people on the screen. I thought identifying actors would surely be a solved problem by now, but I guess Amazon knows best.

Who is that actor on the screen? Emacs/LLM/Fun Redux

I’ve got a cold, so I futzed around a bit more with this…

To try to answer that eternal question that we all ask ourselves when we watch a move — who’s that, then? — I poked at ChatGPT to see whether it could tell me. And the answer was “kinda”, but it didn’t really want to, so the results were a bit hard to use in practice.

However, because Google dropped the “don’t be evil” motto (obviously), Gemini has no scruples whatsoever about identifying people. Which means that I can get it to output data in a more useful manner.

I asked it to return most famous movies, and also the IMDB ID. This means that I can display the actor headshot to see whether the answer is correct. I have to create an OSD overlay for mpv, which led me to further mpv fun:

Eurmh… Yeah, yeah, I should read the ImageMagick manual, but from bitter experience I know that it’s not super helpful on the “raw” formatting stuff.

OK, I’ll ask Google:

What? RBGA? Swap? That sounds suspiciously wrong, but I tried it anyway, and it was wrong.

That one was actually right! Except that it didn’t have -background transparent, so it didn’t really transpere (that’s a word).

There. I fixed it!

Oh, I love the helpful mpv error messages…

Anyway, after futzing around with this a bit more, I got it to work:

OK, what with all the back and forth between Gemini and IMDB, it takes several seconds to get the data. And…

That’s not a picture of Jane Russell. That’s Geoffrey Rush:

It’s kinda fascinating that Gemini gets the hard stuff right (identifying Jane Russell), but is bad at mapping that to imdb IDs. After testing some more, it seems to get the right ID about half of the time, and the rest of the time, it’s just a random person? Let’s try again.

Err… Let’s try again:

OK, Gemini isn’t very good at IMDB IDs. I’m really looking forward to all companies and gummints firing everybody and just relying on LLMs. That’s going to be so much fun…

Anyway, perhaps I should just ditch that LLM part and look it up in IMDB myself:

The problem is, of course, that there’s oodles of people with the same name in IMDB. I could filter for famousness, though. Hm…

Yup. But I don’t know whether this is better than the LLM’s guesses… People aren’t consistently named anyway (“Michael Fox” and “Michael J. Fox”, etc).

And showing both images would be annoying (and take even longer).

Oh well.

But looking it up in imdb works for Jane Russell, at least. So there you go.

And now I’m going to dedicate myself to feeling sorry for myself again. *cough* *cough*

Book Club 2025: Rent spel by Tove Jansson

Jansson’s books non-Moomin books were out of print for quite a while, but they were all released in new editions a while back, so I bought all the ones I hadn’t read yet, and I’ve slowly been making my way through them.

Most of them are very short (this one is just eighty pages long), and I guess you could say they’re kinda variable? Some of them seem very self-consciously “I’m writing for adults now, so there!”, and if I understand correctly, they weren’t well received in Sweden or Finland. And most of them were not widely translated. (I think that’s changed in the last decade or so.)

This one is absolutely wonderful. It’s not a novel per se, but it’s a collection of vignettes that are all about two women who live together, and they’re artists, and they spend a lot of time on a wind-blown little island outside of Finland. So it’s natural to read this as autobiographical, but I have really no idea whether it is or not: Of the two characters, the one that’s the analogue of Jansson’s partner is more of a viewpoint character than the one that’s Jansson’s analogue.

It’s a really sweet, funny and touching little book.

I’m not Swedish myself, but the language in the book seems more than a bit old-fashioned? That is, even if I’ve read Swedish all my life, there were more than a few words where I went “eh? eh?”. But perhaps that’s because Jansson is Swedish-Finnish (Swedish language but living in Finland), so the way of phrasing might be sorta archaic? I don’t know; just babbling.

Rent spel (1989) by Tove Jansson (buy new, buy used, 3.89 on Goodreads)