Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Automatically select an appropriate background colour based on the image's luminance #22

Closed
3 of 5 tasks
oparoz opened this issue Sep 4, 2016 · 8 comments
Closed
3 of 5 tasks
Assignees
Labels
design Related to the design enhancement New feature or request

Comments

@oparoz
Copy link
Member

oparoz commented Sep 4, 2016

From @oparoz on March 11, 2015 23:30

Current situation

  • The large previews use a black viewport
  • Each picture has a 30 pixels wide white border and a white background
  • A toggle-background button was introduced so that the background+border could be turned off. There is a discussion going about what should be the default behaviour. See Use EXIF taken date as sorting date for photos [$200] #40

The problem

This is not ideal as currently users have to manually adjust the background+border if they're viewing very bright pictures and the white border doesn't look very nice with dark pictures with no transparency.

It gets worse in slideshow mode as you have to adjust the background if reaching a picture which can't be properly seen with the currently selected background.

Solution

IE8 is not supported

Next steps

Feasibility study

I did some experiments both in PHP and JS and it's doable.
Background switcher should stay imho, at least as an option.

  • Build proof of concept

Development

The amount of work required is estimated at 2 days, including extensive testing

  • Secure funding
  • Build specifications

Implementation details

  • Ignore some media types, either to speed things up or because we can't easily calculate their luminance without using additional libraries
  • Calculate the luminance
  • Calculate the alpha level
  • Calculate what the optimum background colour should be

QA

If the accuracy level reaches 90%, the toggle button (#40) could be removed

  • Gather a large sample of very different pictures to test with
  • Optimise the algorithm so that it gets it right >75% of the time. % tbd based on funding.

@anarcat - Do you have some sample pictures? Would auto white/black be OK?
@jancborchardt - This would solve the white border issues when going fullscreen and should improve usability

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Copied from original issue: owncloud/gallery#84

@oparoz oparoz self-assigned this Sep 4, 2016
@oparoz oparoz added design Related to the design enhancement New feature or request feature:slideshow labels Sep 4, 2016
@oparoz
Copy link
Member Author

oparoz commented Sep 4, 2016

From @anarcat on March 12, 2015 0:14

here's hopefully a sample: image

a good test is the images generated by nagios's status map.

i still believe just having a gray background would be a good compromise.

@oparoz
Copy link
Member Author

oparoz commented Sep 4, 2016

Thanks! That's detected as a very dark picture and a white background is automatically selected when in full screen.

@oparoz
Copy link
Member Author

oparoz commented Sep 4, 2016

From @jancborchardt on March 18, 2015 11:59

@oparoz I don’t know about this. The dark background is simply standard for image viewers. It would be incredibly janky if the background would change when switching images. This seems like overthinking it.

We shouldn’t have a background switcher, nor have it switch automatically. The only thing we wanted to solve is the issue for transparent images, and we kinda did that.

@oparoz
Copy link
Member Author

oparoz commented Sep 4, 2016

Well, the problem is that the white background + border isn't working well for pictures, so we need to find a way to only turn it on only for dark, transparent images and they're not necessarily all in the same folder or one after the other.

@oparoz
Copy link
Member Author

oparoz commented Sep 4, 2016

From @jancborchardt on March 18, 2015 12:16

@oparoz ah ok – you were talking about the background of the image – not of the whole overlay? In that case sorry. :)

@oparoz
Copy link
Member Author

oparoz commented Sep 4, 2016

Yeah, I've tried to use the word viewport to make the distinction between the whole background and the image's background, but I'm happy to take suggestions on how to word it better :)

@oparoz
Copy link
Member Author

oparoz commented Sep 4, 2016

Maybe I should start a bountysource funding campaign...

oparoz added a commit that referenced this issue Nov 23, 2016
Does not work for SVG

Fixes #22

Signed-off-by: Olivier Paroz (oparoz) <[email protected]>
@oparoz
Copy link
Member Author

oparoz commented Nov 24, 2016

PR is in #179

@anarcat

oparoz added a commit that referenced this issue Mar 12, 2017
Does not work for SVG

Fixes #22

Signed-off-by: Olivier Paroz (oparoz) <[email protected]>
@oparoz oparoz closed this as completed in 62cfa78 Apr 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
design Related to the design enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant