QL-Win / QuickLook

Bring macOS “Quick Look” feature to Windows

Home Page:http://pooi.moe/QuickLook/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to preview bmp notification

mpanzica opened this issue · comments

Hello,

Whenever I try to preview the attached bitmap I get a "Failed to preview..." notification even though the preview is actually showing.

To Reproduce
Copy the attached file to your desktop.
Select it. Press Spacebar.

Expected behavior
Preview to show without any issues.

Desktop

  • Windows 11 (22H2 Build 22621.1848)
  • QuickLook Version: 3.7.3 from Microsoft Store.

Please find a screenshot and the offending file attached.
Thank you for your handy tool.

Maurizio.

Attachment.zip

Just wanted to say that I can open the file in QuickLook V3.7.3 on Windows 10 without issues. Maybe that information may help someone pin down the problem :)

A

Fails with:

System.ArgumentException: Width and Height must be non-negative.
   at System.Windows.Size..ctor(Double width, Double height)
   at QuickLook.Plugin.ImageViewer.MetaProvider.GetSize()
   at QuickLook.Plugin.ImageViewer.Plugin.Prepare(String path, ContextObject context)
   at QuickLook.ViewerWindow.BeginShow(IViewer matchedPlugin, String path, Action`2 exceptionHandler)

bmp has a negative height:

exiv2.exe MaterialColors-14x19.bmp
File name       : MaterialColors-14x19.bmp
File size       : 1120 Bytes
MIME type       : image/x-ms-bmp
Image size      : 14 x -19
MaterialColors-14x19.bmp: No Exif data found in the file

Hello,

Sorry for bumping back to this issue.
From the exception you get, I guess that you are reading the bitmap w&h to properly set the window dimensions.
According to the BMP file format, a negative height is not an error at all. It means instead that the pixel colors are listed from top to bottom instead of bottom to top. Hence negative values are fully legit for both width and height.
As a matter of fact the 'Details' tab on the file property dialog reports the correct bitmap height.
I'd suggest to take the abs() value of the bitmap width and height to solve this issue.

You may want to take a look at the following link for a deeper view of the BMP File Format

Cheers.
M.