fire-eggs / DarkThumbs

Adds thumbnail preview to Windows Explorer for EPUB, FB2 and Kindle ebooks; CBZ, CBR, RAR and ZIP archives.
411 stars 22 forks source link

DarkThumbs to support SVG images #34

Open fire-eggs opened 2 years ago

fire-eggs commented 2 years ago

Fallout from issue #31.

DarkThumbs V1.x uses GDI+ functions to handle images. Those functions don't support SVG files.

Unfortunately, there doesn't seem to be a readily available WIC decoder for SVG files?

powertoys has a thumbnail preview for SVG, source. It also has Preview Pane support.

fire-eggs commented 2 years ago

On further investigation, it turns out the SVG files in the epubs from issue #31 are merely containers for base64-encoded bitmap images.

fire-eggs commented 2 years ago

... and the Powertoys implementation uses .NET. So that's a dead-end.

fire-eggs commented 2 years ago

Try third-party extension (need to add .SVG as allowed image inside DarkThumbs)

https://github.com/tibold/svg-explorer-extension/releases powertoys

fire-eggs commented 1 year ago

For V1.7, I've partially addressed this issue. Here's what it looks like:

issue34_17

DarkThumbs V1.7 shows the image from the cover, but isn't able to show the text.

As a reminder to my future self, the technical details are:

  1. The "advanced" ebooks from Standard Ebooks use a SVG file for the cover image.
  2. Windows provides no SVG support in WIC.
  3. The SVG files consist of two main parts: an embedded, base64-encoded JPEG file in an <image> tag, and SVG operations to draw the text over the image.
  4. SVG libraries for C++ which I've investigated should be able to support rendering SVG to create a bitmap ... except they don't support the <image> tag!
  5. Thus for V1.7 I've manually unpacked the <image> tag [assuming they fit a specific pattern] as the thumbnail.
  6. A future version of Darkthumbs could use a SVG library (lunasvg looks promising) to render the rest of the SVG on top of the current thumbnail.
vivadavid commented 1 year ago

For V1.7, I've partially addressed this issue. Here's what it looks like:

issue34_17

DarkThumbs V1.7 shows the image from the cover, but isn't able to show the text.

As a reminder to my future self, the technical details are:

  1. The "advanced" ebooks from Standard Ebooks use a SVG file for the cover image.
  2. Windows provides no SVG support in WIC.
  3. The SVG files consist of two main parts: an embedded, base64-encoded JPEG file in an <image> tag, and SVG operations to draw the text over the image.
  4. SVG libraries for C++ which I've investigated should be able to support rendering SVG to create a bitmap ... except they don't support the <image> tag!
  5. Thus for V1.7 I've manually unpacked the <image> tag [assuming they fit a specific pattern] as the thumbnail.
  6. A future version of Darkthumbs could use a SVG library (lunasvg looks promising) to render the rest of the SVG on top of the current thumbnail.

Thank you for the partial fix! Looking forward to seeing how this lunasvg works!