Bug 258514 - File dialog: Don't show frames and shadows around thumbnails of AppImage icons, SVGs, and raster files with an alpha channel
Summary: File dialog: Don't show frames and shadows around thumbnails of AppImage icon...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: Open/save dialogs (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: Peter Penz
URL:
Keywords:
: 127291 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-01 20:47 UTC by Pedro Lobo
Modified: 2018-09-05 19:26 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.51


Attachments
Screenshot of problem (78.60 KB, image/png)
2010-12-01 22:51 UTC, Pedro Lobo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Lobo 2010-12-01 20:47:39 UTC
Version:           unspecified (using KDE 4.5.3) 
OS:                Linux

When previews are enabled, there is an unsightly black border around small png files with alpha channels.

Reproducible: Always

Steps to Reproduce:
Enable preview of small png files with alpha channels

Actual Results:  
Black border around image previews

Expected Results:  
No border as happens woth jpeg and others
Comment 1 Peter Penz 2010-12-01 21:18:29 UTC
Thanks for the report. Could you please attach a screenshot and let us know roughly the size of the original PNGs? I'm a little bit confused about the report because Dolphin per default adds always a black shadow behind image previews (an exception is only made for small and square images)
Comment 2 Pedro Lobo 2010-12-01 22:51:05 UTC
Created attachment 53961 [details]
Screenshot of problem
Comment 3 Pedro Lobo 2010-12-01 22:53:49 UTC
Comment on attachment 53961 [details]
Screenshot of problem

Hi Peter.

In fact the original pngs are rather small. I have however just noticedd that this happens also with some xcf thumbnails (780x487px).
Comment 4 Peter Penz 2010-12-02 08:30:45 UTC
Thanks for the update! I can solve this issue for your 38 x 38 PNGs, but not for 780x487 images: The intention of the shadow is to assure that the image is recognizable above each background (e. g. assume a nearly white JPG above a white background). The only exception where a shadow usually is not wanted are "icons". But whether something is an "icon" or "image" cannot be determined by Dolphin. Currently the algorithm is used that an icon is defined by a square size that can be divided by 8. I guess the "divide by 8" part can be dropped, which would solve your issue at least partly.
Comment 5 Pedro Lobo 2010-12-09 14:03:16 UTC
Hi Peter.

Sorry for taking so long to get back to you.

I see your point and it does make sense. I don't think though that it warrants major alteration. It's not that often I see those previews so I think our time would be better spent correcting some more useful ;)
Comment 6 null 2018-01-10 21:31:51 UTC
In Bug 364527 there is a screenshot (http://imgur.com/a/ExRCx) comparing rendering of SVG previews between Nautilus and Dolphin. The shadows in Dolphin do look quite out of place.

Gwenview on the other hand does not display the frame/shadow for SVGs or raster images with an alpha channel. I think Dolphin should work the same way.
Comment 7 Nate Graham 2018-04-10 21:22:04 UTC
See also the same request for Dolphin: Bug 378701.
Comment 8 Nate Graham 2018-04-13 21:32:43 UTC
*** Bug 127291 has been marked as a duplicate of this bug. ***
Comment 9 Nate Graham 2018-08-25 18:31:19 UTC
Submitted a patch: https://phabricator.kde.org/D15071
Comment 10 Nate Graham 2018-09-05 19:25:49 UTC
Git commit 418dc73262ea41cf12eec2b078ddf8bf1068ba45 by Nathaniel Graham.
Committed on 05/09/2018 at 19:25.
Pushed by ngraham into branch 'master'.

Don't draw frames and shadows around images with transparency

Summary:
This patch improves and simplifies the criteria for whether or not to draw a frame and a shadow around an image's thumbnail. The old size-based detection code was unreliable and gave false positives as well as false negatives. It is replaced with a simple check for whether the image has an alpha channel, which not only automatically matches all icon files, but also non-icon raster images with transparency, which look better without the frame.
FIXED-IN: 5.50

Test Plan:
== PNG with no transparency ==
Previously most would get frames, but some wouldn't, depending on their dimensions. Now all do.

Before:
{F6215116}

After:
{F6215118}

== PNG with transparency ==
Previously most would get frames, but some wouldn't, depending on their dimensions. There was also a bug where screenshots that includes shadows got a double shadow (one from the image itself, another from the frame-and-shadow. Now none get the frame.

Before:
{F6215109}

After:
{F6215110}

Before:
{F6214261}

After:
{F6214262}

Before:
{F6214955}

After:
{F6214956}

Before:
{F6214259}

After:
{F6214260}

Before:
{F6214264}

After:
{F6214265}

== JPEG ==
Previously most would get frames, but some wouldn't, depending on their dimensions. Now all do.

Before:
{F6214939}

After:
{F6214940}

== SVG ==
Previously most (but not all) icon SVGs would not get frames, but some would, depending on their dimensions. Non-icon SVGs would mostly get frames, but some would not, depending on their dimension. Now they only do if they have transparency.

Before:
{F6214943}

After:
{F6214944}

Before:
{F6214977}

After:
{F6214968}

Reviewers: #frameworks, #dolphin, #vdg, broulik, cfeck, abetts

Reviewed By: #vdg, broulik, abetts

Subscribers: anthonyfieroni, markg, abetts, bruns, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15071

M  +1    -8    src/filewidgets/kfilepreviewgenerator.cpp

https://commits.kde.org/kio/418dc73262ea41cf12eec2b078ddf8bf1068ba45