Image Processing Projects
Also see:
Graphics and Colors Lab Reports
Image Processing Reference Library

Program Description Keywords
Aspect Ratio
Demonstrate how to display a rectangular picture in another rectangle of any size while preserving the original aspect ratio. aspect ratio, landscape orientation, portrait orientation, StretchDraw, TPicture, TImage, TShape
CreateMandrillBMP
This "famous" Mandrill image has appeared in many Graphics & Image Processing books. Run this simple Delphi 3 program to read three file streams simultaneously (one for each color plane), reverse each scanline (to match the image in Foley & Van Dam's Fundamentals of Interactive Computer Graphics book), and finally write the 769 KB 512-by-512 by 24-bit mandrill.bmp file. This is a great image to use with the Split program below. File Stream, Sun Raster File, TRGBTripleArray, TRGBTriple, pf24bit PixelFormat, TBitmap, Bitmap.SaveToFile
CryptImage
CryptImage.jpg (868 bytes)
Image Encryption.  Encrypt/Decrypt BMP and JPEG images. XOR, Random, RandSeed, BMP, JPEG, TBitmap, TJEGImage, Scanline, PixelFormat, Palette, CopyPalette, TMemoryStream, Noise Image, pByte, pByteArray,   TMemoryStream.Memory, LoadFromFile, LoadFromStream, ShellExecute, EditNumericKeyPress
Fade
Draw "Daisy" image and fade image "out" or "in" in 32 steps by changing image intensity with ScanLine. Works well for small images, but needs to have slight flicker eliminated for large images.

Use this technique for 24-bit bitmaps on high color or true color displays since palette animation can only be used with 256-color displays.
ScanLine, TRGBTripleArray, SHR, InvalidateRect, RedrawWindow, Repaint
Feathering
Demonstrate how to merge a foreground and background image by fading from one image to the other, but only along a transition edge drawn with a simple drawing tool. feathering, vignette, foreground image, background image, bitmap tiling, BMP, JPG, GIF, TGIFImage, TPicture, JPG to BMP conversion, BMP to JPG conversion, JPEG Quality, KeyPreview, rubber band line, MouseDown, MouseMove, MouseUp, object translation, ClientToScreen, ScreenToClient, Simple Drawing Tool, TList, TVectorGraphicsList, TVectorGraphicsNode, TRectangleNode, TRoundRectangleNode, TEllipseNode, TDrawingTool, TDrawingHandle,  object "handles", RestrictCursorToDrawingArea, Windows.ClipCursor, SquareContainsPoint, Windows.PtInRect, Marching Ants, LineDDA, TPenStyle, TLogBrush, Geometric Pens, ExtCreatePen, PS_GEOMETRIC, PS_ENDCAP_SQUARE, TCombBox, OnDrawItem, Scanline, TRGBTripleArray, blur, invert, Clipboard, CF_BITMAP, Clipboard.HasFormat, TControlCanvas, cropping, flip, reverse
FlipReverseRotate
Flip (top-to-bottom) and/or reverse (left-to-right) a 24-bits/pixel TBitmap. Three methods are Flip/Reverse are compared: Scanline, CopyRect, StretchBlt. In addition to a flip and/or a reverse, an rotation of a multiple of 90 degrees (0, 90, 180, 270 degrees counterclockwise) is possible (but only when using the Scanline method). TBitmap, TImage, Scanline, CopyRect, StretchBlt, Reverse Bitmap, Flip Bitmap, Rotate Bitmap 90 degrees, Bitmap Function, TRGBArray, pRGBArray, PixelFormat, pf24bit
HistoStretch Grays
HistoStretch.gif (959 bytes)
Using Histogram Stretching to Improve Image Contrast in a Gray-Scale Image Histogram, grayscale, histogram stretching, RGB, YIQ, TPicture, BMP, JPG, GIF, pixel, TRGBTripleArray, Scanline, TBitmap, TImage, THistoArray, TRGBHistoArray, THistogram, GetStatistics method, GetHistogram method, GetPercentileLevel method, min, max, range, mode, median, mean, standard deviation, kurtosis, math unit, NaN, Plural function, RGBTripleToY function, CountColors function, TBits
Image Enhancement
Perform on the fly, flicker free gray-scale image enhancement  and thresholding using a palette with pf8bit bitmaps 256 gray scale, pf8bit Bitmap, Palettes, Brightness, Contrast, Thresholding, GetDIBColorTable, SetDIBColorTable, ScanLine, PixelFormat, LOGPALETTE, PALETTEENTRY, RBGQUAD, Builder
Magnifying Glass
Magnify.gif (969 bytes)
Demonstrate how to create a digital magnifying glass, a circle or a rectangle,  to enlarge a small selected area of an image. CopyMode, cmSrcCopy, cmSrcAnd, Bitmap Mask, CopyRect, Transparent, Draw, Ellipse, Rectangle, Invalidate, GetPixelFormatString, IsPaletteDevice, LoadGraphicsFile, Magnification Factor, BMP, JPG, WMF, EMF, GIF, WmEraseBkgnd, TIniFile, MulDiv, OpenPictureDialog, TPicture/TGraphic polymorphism
Pixel Profile
PixelProfile.gif (1269 bytes)
Show the "Pixel Profile" graphs for R, G, B, Intensity, H, S, or V from a line drawn over an image.  The example shows how to count the kernels of corn along a line in an image of maize corn. TChart, MouseDown/MouseMove/MouseUp, XOR Rubberband, Scanline, RGB, HSV, RGB/HSV Conversion, Intensity, TRGBTripleArray, TPicture, GraphicFilter, RestrictCursorToDrawingArea, RemoveCursorRestrictions, NearLine function
RotatePixels
Rotate Pixels of Canvas by 0, 90, 180, or 270 degrees counterclockwise by assigning pixels from one Canvas to another. This is effective but slow. The rotation in FlipReverseRotate works just like this example but uses the Scanline property. A more general rotation is possible with RotateScanLine. Pixels Property, Bitmap Rotation
RotateScanLine
Rotate a 24-bit bitmap any angle using ScanLine property. Use spinboxes to change angle of rotation or center of rotation. Rotation of 640 x 480 24-bit bitmap takes about a second on a 166 MHz Pentium. Scanline, Bitmap Rotation, pf24Bit PixelFormat, pRGBArray, TRGBArray, TRGBTriple, GetTickCount, BMP, JPG, GIF, EMF, WMF
Scanline Tech Note Manipulating Pixels with Delphi's Scanline Property Scanline Bitmap property, PixelFormat, pfDevice, pf1bit, pf4bit, pf8bit, pf15bit, pf16bit, pf24bit, pf32bit, pfCustom, bmDDB, bmDIB, EInvalidGraphic, Canvas Pixels property, GetDIBits, Bitmap rotation, TByteArray, pByteArray, TWordArray, pWordArray, TRGBTripleArray, pRGBTripleArray, TRGBQuadArray, pRGBQuadArray, PixelFormat conversion, palettes, GetPaletteEntries, reserved colors, color cycling, IdleAction, optimization
Single-Bit Bitmaps
Example of pf1Bit Bitmaps:
Shows how to use ScanLine and pByteArray to create and manipulate pf1Bit bitmaps. Examples include: Black, White, Stripes, "g", Arrow and Invert.  Palettes and pf1bit bitmaps are also discussed.
Scanline, PixelFormat, pf1Bit, pByteArray, palette, CreatePalette, TMaxLogPalette
Slide Show
SlideShow.gif (1054 bytes)
Utility to display images (BMP, JPG, ICO, WMF, EMF and optionally, GIF) from a directory and to print them in matrix form. RGB, HSV, BMP, JPF, ICO, WMF, EMF, GIF, FindFirst/FindNext/FindClose, Monochrome, Color Inversion, StretchDIBits
Tween
Fade from one image to another Scanline, Tween Image, TList of TBitmaps, CreateTweenBitmap function
Tech Note:
USAF and Microcopy
Test Charts

USAFTestElement.gif (1536 bytes)
Some notes on resolution test targets, including
a pixel profile to quantify resolution.
USAF 1951 3-Bar Resolving Power Test Chart, Microcopy Resolution Test Chart (NBS 1010A), resolving power, Selwyn's "Rule of Thumb," MIL-STD-150A

Also see Printer Demo #1 (Item A-2) in Printer Projects for how to use the StretchDIBits Windows API call to print bitmaps.


Updated 6 Nov 2011
Since 1 Nov 1998