Nyx0uf / qlImageSize

QuickLook and Spotlight plugins to display the dimensions, size and DPI of an image in the title bar instead of the filename. Also preview some unsupported formats like WebP & bpg.
MIT License
1.19k stars 66 forks source link

Latest WebP quicklook does not works for macOS moyave (10.14) #38

Closed dreampiggy closed 5 years ago

dreampiggy commented 5 years ago

qlImageSize version: v2.6 libwebp version: libwebp v1.0.2

Today I'm trying qlImageSize quicklook to view WebP images. The demo image is here: https://www.gstatic.com/webp/gallery/1.webp. But with no success. The quicklook show empty and keep loading.

Since I'm a iOS/macOS developer, I try to debug this quick look plugin by using the https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/Quicklook_Programming_Guide/Articles/QLDebugTest.html

After I running the Xcode in Debug configruation, and view a demo 1.webp, the console output is here:


2019-03-17 17:44:43.963467+0800 qlmanage[31010:241410] [default] Unable to load Info.plist exceptions (eGPUOverrides)
Testing Quick Look preview with files:
    /Users/lizhuoli/Downloads/1.webp
2019-03-17 17:44:44.137529+0800 qlmanage[31010:241429] [com.apple.QuickLookDaemon] CGImageCreate: invalid image bits/component: 8 bits/pixel 24 alpha info = kCGImageAlphaNoneSkipLast
``
dreampiggy commented 5 years ago

From my code contribution for SDWebImage's repo, the code to generate CGImage in webp_decode.m is not correct. The channel of bitmap buffer is 3(24bit), but you use the kCGImageAlphaNoneSkipLast (4 channel, 32bit). See more on: https://github.com/SDWebImage/SDWebImage/pull/2348.

Chaning the code in webp_decode.m:80 from:

CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Big | (webp_cfg.input.has_alpha ? kCGImageAlphaPremultipliedLast : kCGImageAlphaNoneSkipLast);

into:

CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Big | (webp_cfg.input.has_alpha ? kCGImageAlphaPremultipliedLast : kCGImageAlphaNone);

Can solve the issue.

dreampiggy commented 5 years ago

For macOS 10.14 user, who face the same issue and want a hotfix, you can download my Xcode archive quicklook plugin with the patch #39

qlImageSize.qlgenerator.zip