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

RFC: A next generation exe-thumbnailer #17

Open
jlu5 opened this issue Oct 25, 2019 · 1 comment
Open

RFC: A next generation exe-thumbnailer #17

jlu5 opened this issue Oct 25, 2019 · 1 comment

Comments

@jlu5
Copy link
Contributor

jlu5 commented Oct 25, 2019

Recently I've started work on a Python icon extracting library for PE files: https://github.com/jlu5/icoextract. It includes a lightweight exe-thumbnailer that wraps around Pillow to convert the extracted .ico file to a .png.

This new thumbnailer addresses some of the shortcomings in the current code, such as #3. My plan is to deprecate the current exe-thumbnailer once icoextract is generally available in distro packages (Debian, Ubuntu).

Goals

Here are some more specific goals:

  • Offer a consistent, easy to use API for access to Windows icons. This might benefit future developers since it's less cumbersome than running wrestool et al in a subprocess.
  • Native support for 256x256 large icons. These were introduced in Windows Vista; a decade later, exe-thumbnailer still doesn't support showing them. The new thumbnailer prefers 256x256 icons for large thumbnails and will even resize them to 128x128 for "normal" size thumbnails as needed.
  • Be fast on large files. Whereas wrestool struggles on large files (and we hard cap the thumbnail size limit as a result), pefile has a fast_load option that allows skipping through most of the binary and only loading the sections we're interested in.
  • (As a bonus, icoextract being Python makes writing tests a lot easier, making maintenance more manageable in the long run.)

To keep the code simple though, there are some features I'd like to part ways with.

  • Drop support for .msi and .lnk files. msi files don't include interesting icons, and lnk files most often fail to thumbnail because we can't reliably expand absolute Windows paths on Linux. (.lnk parsing for absolute targets is unreliable #6). In any case, these are separate enough formats that thumbnailing should be handled by different programs.
  • Drop support for displaying program versions. This complicates the code by having to draw overlays, and I'm not convinced that a thumbnail is the right place to put this data. If you move into e.g. Detailed list view, the box is hardly readable.
  • Drop bundled 3rd party artwork and show icons as-is. KDE's .exe thumbnailer and Windows already do this.

Dependencies

The new code depends on pefile for extraction and Pillow for thumbnail conversion. Both of these libraries are actively maintained.

@skitt
Copy link

skitt commented Oct 25, 2019

I like this, and I wouldn’t miss the features you’d like to drop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants