I’m guessing you’ve seen this style of image before – a sort of pseudo-antique filter than can make any image look like it was taken with a very old camera. There are many ways to programmatically generate images like this, and in this article I’ve put together one that does more than just make the image look “brown.” This filter involves several steps (fading, multiplicative brightness, and gamma correction, among others) and results in a conversion that not only adds a sepia coloring, but also gives an image a histogram more in keeping with older photos.
Today’s article brings a collection of random image effects that can be quickly (and programmatically) generated. In an attempt to give the project some coherency, I’ve named each effect after something “nature-themed” so as to help distinguish them. As always, full source code and a sample .exe is provided…
The ability to create custom filters is a mainstay of any quality graphics application. A robust matrix-based filter engine can be used to create tens – even hundreds – of unique image effects by simply manipulating the matrices that get passed into the engine. In this project, I’ve provided a 5×5 custom filter engine with support for both scaling and biasing. This is identical to the custom filter engine provided by Photoshop, and mine is even slightly faster (at least for the screen-sized images I’ve been testing)…
Edge detection (also called “boundary detection”) is a fundamental problem in image processing. The ability to accurately detect visible “edges” in an image has many applications – from missile targeting to OCR to cool Photoshop effects. In this project, I’ve compiled 6 well-known edge detection algorithms (along with two of my own for fun). Full VB6 source code is provided, as well as an .exe for those just interested in the effects alone…
As promised, here is the second half of my histogram code project. In this project, I’ll show you how to stretch a histogram, equalize individual channels, and – most useful of all – equalize an image’s overall luminance. Cool, eh?
Today’s project demonstrates how to quickly and efficiently generate an image histogram. Histograms are invaluable for understanding and implementing a multitude of image processing techniques – including brightness, contrast, levels, curves, equalizing, and more – so it’s worth taking some time to experiment with them. As always, DIB sections are used to generate and render the histograms in real-time…
This little program demonstrates two key graphics programming principles: 1) simple “painting” code – basically, connecting a series of lines together as the user drags their mouse around, and 2) an implementation of the hard-to-find (and poorly documented) dll call for filling a contiguous region of an image. (Photoshop users should know this as the “paint bucket” tool.) As always, sample code and full documentation is provided…
Because the first draft of this project has become so popular, I’ve gone ahead and built a new and MUCH faster version. Updates include: DIB sections for flame drawing, look-up tables, optimized randomization, and custom flame coloring. On my old 1.6ghz laptop this version runs over 4x faster than version 1.0. Enjoy!
Whether working on an old-school RPG or a state-of-the-art FPS, every game programmer needs a fast, cool fire effect at some point in his/her career. In this example, I’ve opted for a straightforward and easy-to-understand method for generating real-time flames. No pre-built images or palettes are used, making the code quite small (only 11kb, including a demo exe) and very easy to reuse. Coloring and flame generation is done using only math and a little cleverness…
Real-time transparency has become so commonplace in modern games and PC applications that it’s almost taken for granted. However, the specific formula that performs this now-ubiquitous effect is worth understanding.
Transparency is simply a weighted average between the color values of two pixels. As an example, consider the following two colors:
Pure red, or RGB(255, 0, 0)
Pure [...]