![]() |
Bitmap manipulation from VBA/VB
I am needing to load a bitmap, then run through some code that would
transform the image by looking at each pixel's color and if the RGB is less than 10,10,10 then change the pixel to some other color. How do I do this? Is there some kind of object I can use that will allow changing this from VB/VBA? -- Regards, John |
Bitmap manipulation from VBA/VB
You can do this if you use Windows API functions; here is a reference for the
Bitmap functions (note in particular GetBitmapDimensionEx and GetPixel/SetPixel) http://msdn.microsoft.com/library/de...tmaps_87eb.asp If you are not familiar with using API library functions you may want to search the MSDN libarary on the topic. -- - K Dales "John Keith" wrote: I am needing to load a bitmap, then run through some code that would transform the image by looking at each pixel's color and if the RGB is less than 10,10,10 then change the pixel to some other color. How do I do this? Is there some kind of object I can use that will allow changing this from VB/VBA? -- Regards, John |
Bitmap manipulation from VBA/VB
I followed the link for the API calls. I found some more info on how to use
API from VBA (see link below). I am still confused on how the API calls will relate to the VBA code...... ActiveSheet.Pictures.Insert( _ "C:\Documents and Settings\JKeith\My Documents\My Pictures\test.bmp" _ ).Select Selection.ShapeRange.IncrementLeft 108 Selection.ShapeRange.IncrementTop 91.5 Selection.ShapeRange.IncrementRotation 60 Selection.ShapeRange.ScaleHeight 0.65, msoFalse, msoScaleFromTopLeft Selection.ShapeRange.ScaleWidth 0.65, msoFalse, msoScaleFromTopLeft Do the API calls for SetPixel directly change the BMP file? (so I would do all the API calls before I "insert" the picture into the spreadsheet?) Is there some way to assign the API picture handle to the pictures.insert? or will this have to be done externally? For anyone that is looking to find out how to call API from VBA.... (this link is for you) http://www.awprofessional.com/articl...?p=366892&rl=1 -- Regards, John "K Dales" wrote: You can do this if you use Windows API functions; here is a reference for the Bitmap functions (note in particular GetBitmapDimensionEx and GetPixel/SetPixel): http://msdn.microsoft.com/library/de...tmaps_87eb.asp If you are not familiar with using API library functions you may want to search the MSDN libarary on the topic. -- - K Dales "John Keith" wrote: I am needing to load a bitmap, then run through some code that would transform the image by looking at each pixel's color and if the RGB is less than 10,10,10 then change the pixel to some other color. How do I do this? Is there some kind of object I can use that will allow changing this from VB/VBA? -- Regards, John |
All times are GMT +1. The time now is 02:46 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com