QLThumbnailProvider -- black borders around image

After lots of wrangling through nonexistent documentation, I finally managed to get my extension to be called. Problem: whatever image I try to draw, there's always black borders around it.


Currently, I'm using `QLThumbnailProvider` and the `provideThumbnail` method to do my work. This is on 10.15.2 (Catalina). For context, I'm trying to render thumbnails of MKV files with embedded cover art. I've extracted the art and used `CGDataProviders` to make it into a `CGImage` -- the last step is getting it to draw properly.


In 10.14, the QLVideo extension worked pretty well (https://github.com/Marginal/QLVideo), but now in 10.15 it's also doing the black-bars-on-the-sides thing. I thought it might be because the QuickLook generator API was deprecated, hence my foray into this new API. No dice.


Here's an illustration: https://imgur.com/yRrcl72

The first image shows the problem I'm having: black borders on the left and right. The second image shows the "expected" output, where the image fits nicely — this is the behaviour with the default thumbnailer for MP4 files.


For reference, here is my current code: https://pastie.io/jdewlj.swift



EDIT: After some experimentation, it looks like the size of the border is fixed; at 128x128 icon size in Finder, the borders always look to occupy around 15 points (measured with the screenshotting tool), regardless of the width of the inside content. My guess is that the old `IconFlavour` option was either broken, ignored, or removed in Catalina, which causes the old qlGenerator plugins to break as well, since it used that option to set minimal decorations.

Replies

After lots and lots of digging, I chanced upon a line of code on Github like this:

const CFStringRef kQLThumbnailPropertyIconFlavorKey_10_5 = CFSTR("IconFlavor");
const CFStringRef kQLThumbnailPropertyIconFlavorKey_10_15 = CFSTR("icon");


from here: https://github.com/shysaur/QLWindowsApps/commit/52f1e070a3fd09371b5194487f1413585b280d02


It appears that the undocumented key for the icon "flavour" was changed in Catalina. So for now, this problem can be resolved using the old QLGenerator API. This doesn't change the fact that using the new QuicklookThumbnailing api/framework, there's no way to set this property, and given that the old API has been deprecated, this issue still remains.


Hopefully this might help future-people googling about this issue, if a moderator ever decides to approve this post.