Hi all,

If I want to read an image and split them into pixel of rgb(red green blue) regarding their color.

Is it possible to do it in vb?
Or I need to use the different program? if you have any clue, please let me know, thanks.

Putting a picture into memory or into a picture box is quite easy with the LoadPicture function. Reading each pixel is also easy, if not slow, by using the point method, which returns a long value that you can then break up into the RGB triplet by using some simple math. On the other hand you could speed the reading of each pixel up by using the GetPixel API.

Once you get started on some code, if you have any problems come back and post the relevant code. We will be more than happy to help...

Good Luck

Putting a picture into memory or into a picture box is quite easy with the LoadPicture function. Reading each pixel is also easy, if not slow, by using the point method, which returns a long value that you can then break up into the RGB triplet by using some simple math. On the other hand you could speed the reading of each pixel up by using the GetPixel API.

Once you get started on some code, if you have any problems come back and post the relevant code. We will be more than happy to help...

Good Luck

thanks for replying
After I think about it, I don't really need to get the rgb the image at all.

Since my program will read a desert map. And the user need to manually specifying several points in the map, then, I need to calculate the best route behind the scene. So, I don't really need to care about topography so much.

I will need something that enable the user to drag drop the things that they need (just like when we drag n drop all the things that we need in the vb6 form in design phase).
What should I use?

Thanks a lot

Okay, sounds like you want to do a map editor where you can drag various objects like the terrain, buildings, and other features onto the map and then save the resulting image.

Have a look at this search on PSC where you will find more code than than you need...

http://www.planet-source-code.com/vb/scripts/BrowseCategoryOrSearchResults.asp?optSort=Alphabetical&txtCriteria=map+editor&blnWorldDropDownUsed=TRUE&txtMaxNumberOfEntriesPerPage=10&blnResetAllVariables=TRUE&lngWId=1

Good Luck

Sorry for my dummy question.

The program that I've downloaded from the link that you gave me is using .map file.

But, I want to be able to scan the normal .jpg file and use it as a base for drag n drop.

Is .map file is also a picture file? or is it a "modified" picture file?
So I need to have a program to convert from .jpg to .map, then use that kind of methodology?

Thanks

Don't know which program you are talking about because there are just so many but search the code for .map. Find where it is loaded/saved and I'm betting that it is a text file or binary file that tells the program which images to put where.

Good Luck

Don't know which program you are talking about because there are just so many but search the code for .map. Find where it is loaded/saved and I'm betting that it is a text file or binary file that tells the program which images to put where.

Good Luck

thanks, yup .map is a binary file. I cannot use it in my project, but I'm able to understand the way everything is connected and that's enough for me. thanks a lot

This question has already been answered. Start a new discussion instead.