The new vbAccelerator Site - more VB and .NET Code and Controls
Source Code
4 vbMedia &nbsp
Image Processing Using DIB Sections
Everything to do with images: blur, soften, sharpen, colourise, colour reduce, resample ...

NOTE: this code has been superceded by the version at the new site.


vbAccelerator Image Processing Demp Application

Download the DIBSection Image Processing Sample application (161kb)
Download the Realtime DIBSection Animation Sample (112kb)
Download the DIB Section Class Only (4kb)

This sample requires the SSubTmr.DLL component because it includes an implementation of my Progress Bar control. Make sure you have loaded and registered this before trying the project.

&nbsp UpdatedUpdated! 17 February 1999 &nbsp
&nbsp The previous version of this code crashed when run under NT4.0. This was because the code was not always clearing up the SAFEARRAY pointer after it had finished using it. Under Win9x, this did not cause a problem but NT is stricter. All the samples and the code are now updated to fix this problem. &nbsp

This sample demonstrates a new 24 bit image processor using the DIB Section GDI object. It also provides a sample demonstrating realtime image fading and manipulation for those pointless but kinda fun About screens.

What you can do with this sample:

  • Image Processing
    • Blurring and softening
    • Sharpening
    • Embossing
    • Customised filters
    • Minimum, Maximum and Average Rank filters for impressionistic effects
  • Colour Manipulation
    • Colourise images
    • Darken and Light images
    • Gray scale images
    • Floyd Stucci Black and White conversion
    • Decrease colour depth by dithering and matching to a specified palette.
  • Image Combination
    • Add, subtract with offsets or take the darkest/lightest pixels
  • Resample Images
    • Demonstrating how to use interpolation to create a smooth resized version of an image.

Supporting Technical Article

Performing the other simple filters (softening, blurring, sharpening, embossing) is described in my previous image processing sample. This code sample simply takes exactly the same image processing class but modifies it to operate on the DIB Section class rather than a Picture object.

Some Notes
Although all the samples should run on systems with a colour depth of 256 colours or less, there will be two problems:
  1. The image will be rendered by GDI doing an arbitrary colour depth reduction.
  2. GDI is often slow when colour reducing DIBs to display on the screen.
As usual, with graphics code, running it in the IDE will be like watching paint dry. To get the techniques in these samples to perform, you must compile to Native Code (optimised for Fast Code). You can also get a significant speed increase (60% or more) by checking all the Advanced Optimisations settings.


TopBack to top
Source Code - What We're About!Back to Source Code Overview


AboutContributeSend FeedbackPrivacy

Copyright 1998-1999, Steve McMahon ( All Rights Reserved.
Last updated: 25 August 1999