ariya.io About Collections Archives

Tinting through composition

1 min read

Another example that I showed in Developer Days was an alternative way to tint an image. Suppose you want to have a little feedback to the user when s/he puts the mouse on an icon, what you can do is to colorize the icon while the cursor is still on top of it. Changing the overall tone of the color of an image can be done in different ways. One obvious way is to convert every pixels from RGB to HSV, perform some manipulations on the hue and perhaps also saturation, then convert back the result to RGB, which will be the final color of those pixels. A rather different and less correct approach (though the result is still visually good) is to convert the image to grayscale and then overdraw a big rectangle with certain composition modes, check out my latest entry on Qt Labs Blogs exactly on that matter: Colorize an image via painter composition.

The included example can also take an image from the web, e.g. drag and drop from Flickr. In case you want to know the trick and/or look for a simple example of QNetworkAccessManager, then follow the simpler code for image viewer with support for remote URL.

Related posts:

♡ this article? Explore more, check the archives, or follow me Twitter.

Share this on Twitter Facebook Google+

comments powered by Disqus