Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DarkThumbs to support SVG images #34

Open
fire-eggs opened this issue Oct 22, 2021 · 5 comments
Open

DarkThumbs to support SVG images #34

fire-eggs opened this issue Oct 22, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@fire-eggs
Copy link
Owner

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 fire-eggs added the enhancement New feature or request label Oct 22, 2021
@fire-eggs
Copy link
Owner Author

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
Copy link
Owner Author

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

@fire-eggs
Copy link
Owner Author

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

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

@fire-eggs
Copy link
Owner Author

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
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants