Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Downloads
Search: 

GDI+ image class
Alexander Golovlev, Epam Systems
GDI+ Image class is a VFP class to load, save and transform BMP, JPEG, GIF, PNG and TIFF images. It provides also creating thumbnails, resizing, cropping and rotating, conversion to/from Picture object, copying to/from clipboard, capturing of screen or any window.
Created on
20 years ago
Downloads
6506
File type
Freeware
Rating
4.89/5.00
General information
Rating:
4.89/5.00 (9 rates) Rate this item
Description
This class is based on GDI+ and requires gdiplus.dll which is freely available and can be installed on Win98 and higher. If you have not installed WinXP or .NET runtime then you can download this DLL from http://www.microsoft.com/downloads/release.asp?releaseid=32738 or directly: http://download.microsoft.com/download/platformsdk/redist/3097/W98NT42KMeXP/EN-US/gdiplus_dnld.exe gpImage.prg file contains two classes. gpInit class declares required API functions and initializes GDI+. The single instance of this class must be created before use of gpImage class and must exist all the time when GDI+ is used. Properties and methods of gpImage class are described below.

PropertyExplanation
ImageFormatformat of image: "BMP", "JPEG", "TIFF" etc. (read only
PixelFormatpixel format of image, for example "24bppRGB" (read/write)
ImageWidthwidth of image (read only)
ImageHeightheight of image (read only)
HorizontalResolutionhorizontal resolution in dpi (read/write)
VerticalResolutionvertical resolution in dpi (read/write)

MethodExplanation
Create(tnWidth, tnHeight, tcPixelFormat)Creates an empty image object
Load(tcFileName)Loads an image from file
FromResource(tcFileName, tcBitmapName)Loads an image from bitmap resource in EXE/DLL file. Resource can be identified by name: img.FromResource ("dxdiag.exe", "DIRECTX"), or by number: img.FromResource ("shell32.dll", "#309").
FromPicture(toPicture)Creates an image object from Picture object
GetPicture()Returns Picture object
FromClipboard()Creates an image object from clipboard content
ToClipboard()Copies an image to clipboard
Thumbnail(tnWidth, tnHeight)Creates thumbnail of specified size
SaveAsBMP(tcFileName)Stores image in BMP file
SaveAsJPEG(tcFileName, tnQuality, tnTransform)Stores image in JPEG file. Optional parameter tnQuality specifies quality of JPEG compression, 0 - highest compression, 100 - highest quality, default value - 75. Optional parameter tnTransform specifies type of transformation without loss of information, any of EncoderValueTransform values.
SaveAsGIF(tcFileName)Stores image in GIF file
SaveAsTIFF(tcFileName, tnCompress, tnColorDepth)Stores image in TIFF file. Parameter tnCompress specifies type of compression, any of EncoderValueCompression values, optional. Parameter tnColorDepth specifies number of colors in bits per pixel (1,4,8,16,24,32,48,64), optional.
SaveAsPNG(tcFileName)Stores image in PNG file
SaveAsMultipageTIFF(tcFileName, tnCompress, tnColorDepth)Stores image as first page of multipage TIFF file
SaveAddPage(tnImage)Adds specified image as page of multipage file. Parameter tnImage is a value, returned by GetImage() function of another image object.
GetImage()Returns pointer to GDI+ image object which can be used in API functions and SaveAddPage() function.
GetPixelColor(x, y)Returns color value of pixel
GetPixelAlpha(x, y)Returns alpha value of pixel
SetPixel(x, y, tnColor, tnAlpha)Sets color and alpha values of pixel
Crop(x, y, tnWidth, tnHeight)Crops an image
RotateFlip(rotateFlipType)Rotates and flips an image
Resize(tnWidth, tnHeight, tnInterpolationMode)Resizes an image
GetPageCount()Returns number of pages in multipage (TIFF) file
SelectPage(tnPage)Selects the specified page in multipage (TIFF) file
GetFrameCount()Returns number of time frames in multiframe (GIF) file
SelectFrame(tnFrame)Selects the specified time frame in multiframe (GIF) file
Capture(thWnd)Captures the window, specified by handle or desktop, if handle is not specified
gpImage.h file contains definitions of ImageFormat, PixelFormat, EncoderValueTransform,rotateFlipType, InterpolationMode constants.
Created by
Alexander Golovlev, Epam Systems
Visual C++, ATL/WTL, C#, ASP.NET, WinForms, MS SQL

Comments
Thank you, Alexander. The SaveAsMultipageTIFF and SaveAddPage functions worked perfectly. You have save me untold weeks of coding. Andy Rice, May 14, 2003

Yahoo! This will save me tons of time! Thanks! Paul Macdonald, May 19, 2003

Thank you very much Alexander for this powerfull tool. It ist very usefull and works perfecty. I have saved a lot of time while using it instead of a self coded solution. Antonius-Maria Schwefer, November 11, 2003

Alexander, anyone who works with images and VFP needs to look at this class! Works Great! James Harvey, June 6, 2004

Really good! But EXIF information is missing when converting jpg file with RESIZE(..) and then SaveAsJPEG(..) Sergey Dydyshko, February 3, 2006

Now I can automate what I was doing manually for months! And I got it to work in just a few minutes. Really great! Dragan Nedeljkovich, January 6, 2007

Add a comment
More downloads created from this member
Alexander Golovlev, Epam Systems
OLE DB Library for Visual FoxPro provides an access to remote data sources using OLE DB data providers and retrieving query results directly into VFP cursors. It includes also object which performs conversion between ADO recordsets and VFP cursors. Data Source object provides read-write access to d...
Created on
22 years ago
Downloads
3323
File type
Rating
4.71/5.00
Alexander Golovlev, Epam Systems
This COM library performs arithmetic operations with 28 digits of precision using Decimal arithmetic system functions. The Decimal value type is appropriate for financial and monetary calculations requiring no round-off errors. Version 1.1 includes also basic mathematical functions (Sqrt, Exp, Log, ...
Created on
22 years ago
Downloads
969
File type
Rating
3.00/5.00
Alexander Golovlev, Epam Systems
This is a further development of Cross Tab Query sample. Now it made as VFP custom class that supports all input data types and can be used as a VFPXTAB replacement. And, of course, it still works with a large resulting datasets a hundred times faster than VFPXTAB. Test application included.
Created on
22 years ago
Downloads
4896
File type
Rating
5.00/5.00
Alexander Golovlev, Epam Systems
This sample demonstrates how to copy and rename keys in registry using WinAPI.
Created on
22 years ago
Downloads
706
File type