OnErr0r
07-21-2003, 01:02 PM
This sample contains a very basic GDI+ class wrapper. It is similar in some ways to the .net GDI+ wrapper.
It shows how to decrease colors in an image from 24bit to 8 bit. And various other numbers of colors as well, from 8 to 256. Quantization is done by using an octree. Many thanks to vbaccelerator.com.
GDI+ uses a halftone palette by default to save the image to file. This leads to terrible quality in many cases. This sample greatly improves the saved GIF image. Enjoy!
OnErr0r
07-21-2003, 01:12 PM
A quick note for VB5 users. In frmViewer.frm you can make a slight change. I fixed the .vbp, but forgot the form.
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
That should be the correct version.
OnErr0r
07-22-2003, 11:58 AM
I found a small bug in the code. The last scan line of the image is not shown. I had been changing the loop around and left out an equals sign. In modQuant.bas the QuantizeImage function change the loop to:
Loop While Y >= -1
OnErr0r
02-11-2005, 10:49 AM
The gdiplus.dll version 6.x now offers color quantization with minimal coding. With as little as two lines of code a GDI+ bitmap can be quantized with an optimal palette. If a custom palette is desired, GDI+ does excellent error reduction dithering from the original image to the new palette. This example also demonstrates histogram generation for an image.
If you have Office 03, Visio 03 or PowerPoint Viewer 03, then you should have version 6 installed already. You will need to move the dll to the app.path of this project, or \windows\system32 or equivalent. If you are an XP user, place the gdiplus.dll in the app.path of the exe. Then create an empty file called: Exename.exe.local
That will allow XP Side-by-side component sharing to find the dll.
The new tlb has a new GUID and version, so it will not interfere with any previous versions. It cannot be used with the 5.0 version of the dll, as various functions do not exist.
If you do not have any of those installed, you can get the free PowerPoint Viewer 03 here: http://www.microsoft.com/downloads/details.aspx?FamilyId=428D5727-43AB-4F24-90B7-A94784AF71A4&displaylang=en
Once installed, you will then find the gdiplus.dll 6.0.32.64 (or newer) installed at: c:\program files\microsoft office\powerpoint viewer. Copy the file and place as mentioned previously.
OnErr0r
12-21-2005, 10:49 AM
GDI+ 1.1 users on XP, see this important note (http://www.visualbasicforum.com/showpost.php?p=1094278&postcount=15).