The TImage32 object contains a single image, and all image operations act upon this object.
uses Image32; ... img := TImage32.Create; //DO STUFF img.Free;
The Image32 Library provides file access to BMP, PNG & JPG storage via the Image32_BMP, Image32_PNG & Image32_JPG modules respectively.
uses Image32, Image32_PNG; ... img := TImage32.Create; img.LoadFromFile('beetle.png'); //DO STUFF img.SaveToFile('beetle_modified.png'); img.Free;
The Image32 library has an extensive list of classes and functions that manipulate images including: hue, luminance & saturation adjustment; box blur & Gaussian blur; erase color; blend merging images; crop; emboss; flip & rotation; scaling; sharpen; skew; transformations; and special effects
uses Image32, Image32_PNG, Image32_Extra; ... img := TImage32.Create; img.LoadFromFile('beetle.png'); EraseColor(img, clAqua32); img.SaveToFile('beetle.png'); img.Free;
![]() ![]() |
uses Image32, Image32_Extra, Image32_PNG; ... img := TImage32.Create; img.LoadFromFile('fruit.png'); Sharpen(img, 3, 30); img.SaveToFile('fruit_sharpened.png'); img.Free;
![]() ![]() |
uses Image32, Image32_PNG, Image32_Transform; ... img := TImage32.Create; img.LoadFromFile('clouds.png'); dst := Rectangle(img.Bounds); dst[0].Y := 20; dst[3].Y := img.Height-20; ProjectiveTransform(img, dst); img.SaveToFile('clouds_proj.png');
![]() ![]() |
Image32 provides a large number of drawing tools.
The Image32_Draw module provides functions for line, dashed line & polygon drawing, and includes several renderers that produce: solid color; tiled image; and linear & radial gradient renders.
The Image32_Vector module also provides numerous functions for vector drawing, including: Rectangle; RoundRect; Ellipse; Pie & Arc; Spline & Bezier; Star; etc.
uses Image32, Image32_PNG, Image32_vector, Image32_Draw, Image32_Clipper; ... var img: TImage32; path: TPathD; paths: TPathsD; radGradRend: TRadialGradientRenderer; begin img.SetSize(256,256); rec := img.Bounds; Windows.InflateRect(rec, -50,-50); //draw a gradient filled star path := Star(PointD(128, 128), 50, 100, 7); radGradRend := TRadialGradientRenderer.Create; radGradRend.SetParameters(rec, clFuchsia32, clYellow32); DrawPolygon(img, path, frNonZero, radGradRend); radGradRend.Free; DrawLine(img, path, 1, clBlack32, esClosed); //draw a dashed outline of the star paths := InflatePolygon(path, 7, jsRound); DrawDashedLine(img, paths, [4,4], 0, 1, clBlack32, esClosed); img.SaveToFile('star.png'); img.Free; end;
![]() |
uses Image32, Image32_PNG, Image32_TTF, Image32_Draw, Image32_Extra; ... var nextX: double; fr: TFontReader; gc: TGlyphCache; begin fr := TFontReader.Create('Impact'); gc := TGlyphCache.Create(fr, DpiAware(48)); gc.GetTextGlyphs( 20, 130, 'Image32', paths, nextX); img := TImage32.Create(400,150); DrawShadow(img, paths, frNonZero, 3); DrawPolygon(img, paths, frNonZero, $FF00DD00); Draw3D(img, paths, frNonZero, 3,4); DrawLine(img, paths, 1, clBlack32, esClosed); img.SaveToFile('c:\temp\tmp.png'); //clean up img.Free; gc.Free; fr.Free; end;
![]() |
This was a deliberate design decision so it'd be relatively easy to translate the Image32 library into another language, and for a different operating system. But having said that, VCL.Graphics is still used in the Image32_PNG and Image32_JPG modules.
All drawing in Windows is performed using Device Contexts (DCs) and Delphi's VCL.Graphics encapsulates DCs in TCanvas objects, with the actual DC being the TCanvas.Handle. So, using TImage32's CopyToDC method, its image can be displayed in any TControl with a TCanvas property; and that includes TForm, TPanel and TImage components.
uses Image32; ... img := TImage32.Create; //DO STUFF WITH img //assuming a standard TImage (Image1) component has been //dropped somewhere onto a form in the Delphi IDE. Image1.Picture.Bitmap.SetSize(img.Width, img.Height); //if 'img' is semi-transparent, prepare the target background Image1.Picture.Bitmap.Canvas.Brush.Color := clBtnFace; Image1.Picture.Bitmap.Canvas.FillRect(Image1.ClientRect); //now copy 'img' to Image1 img.CopyToDc(Image1.Picture.Bitmap.Canvas.Handle); img.Free;
Otherwise use the accompanying ImagePanels unit which contains the TImagePanel and TBitmapPanel components which are powerful image viewers.
Home, ImagePanels, TImage32, Image32_Draw, DrawDashedLine, DrawLine, DrawPolygon, Image32_Vector
Copyright ©2019 Angus Johnson - Image32 ver. 1.55 - Documentation last updated on 8-November-2020