-
Sep 27th, 2007, 08:51 AM
#1
Thread Starter
New Member
FreeImage.DLL GetPiexelColor
Hi guys,
I'm trying to get a pixel color using FreeImage.DLL.
However, I constantly recieve the value false (0), no matter what I do.
How does this function works?
Can someone please simplify it? How to use that function, what does it actually do?
and how come it returns true or false if it suppose to give me the a "color" value (not true\false).
Here's the code:
Code:
Dim infoReader As System.IO.FileInfo
FreeImage.FreeImage_Initialise()
Dim myStream As Stream
Dim openFileDialog1 As New OpenFileDialog
Dim Continue = True
Dim location As String
openFileDialog1.InitialDirectory = "c:\"
openFileDialog1.Filter = "Picture Files (*.bmp)|*.bmp"
openFileDialog1.FilterIndex = 2
openFileDialog1.RestoreDirectory = True
If openFileDialog1.ShowDialog() = DialogResult.OK Then
myStream = openFileDialog1.OpenFile()
If Not (myStream Is Nothing) Then
location = openFileDialog1.FileName
myStream.Close()
End If
End If
picture.Image = Image.FromFile(openFileDialog1.FileName)
dib = FreeImage.FreeImage_Load(FreeImage.FREE_IMAGE_FORMAT.FIF_BMP, openFileDialog1.FileName, 0)
Dim i, j, val As Integer
i = 1
j = 1
FreeImage.FreeImage_GetPixelColor(dib, 8, 9, val)
msgbox(val)
'Trying to set a different value (desperate action)
FreeImage.FreeImage_SetPixelColor(dib, i, j, val+1)
FreeImage.FreeImage_GetPixelColor(dib, i, j, tell1)
Msgbox(val)
The FreeImage Syntax+explanation:
DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value);
Get the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). Parameter x is the pixel position in horizontal direction, and parameter y is the pixel
position in vertical direction. The function returns TRUE on success, and returns FALSE
otherwise (e.g. for palettized images).
-
Sep 27th, 2007, 10:03 PM
#2
Re: FreeImage.DLL GetPiexelColor
I don't use VB.NET (eeeewwww yucky), but I'm fairly certain it'll be close to impossible to use this function correctly.
It uses pointers, which Visual Basic doesn't have. Unless theres a workaround for that.. you're not going to be able to do much.
The color value of the pixel, is stored in value, which is an RGBQUAD pointer. You have to re-create this type (I'm sure theres documentation on the type somewhere), then pass a pointer to it through the function.
I've seen some 'hacks' for using pointers in VB.. but they aren't pretty. You could try passing ByRef.. not sure if that will work though.
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Sep 28th, 2007, 02:23 AM
#3
Thread Starter
New Member
Re: FreeImage.DLL GetPiexelColor
I really do hate VB too, if my tutor had'nt forced me to use that, I'd never choose VB, no matter what.
The thing is, I'm supposed to create a steganography project.
I need to take a char change, take its binary value, and implement it inside the pixels by changing their LSB.
e -> ascii(101) -> 01010010
then the pixel (suppose it's 1110111 change to -> 1110110
it's for my uni'....
hate it.
-
Sep 28th, 2007, 02:55 AM
#4
Re: FreeImage.DLL GetPiexelColor
Theres other ways to get pixel values. Look up how to use the Marshal class to copy the bitmap data into an array.
If this was C#.. you could just use pointers to the bitmap data
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Apr 22nd, 2014, 03:12 PM
#5
New Member
Re: FreeImage.DLL GetPiexelColor
Did you get the correction in code?
I too have to do a project on steganograpghy using vb 2010
I saw the code.in codeproject site and there's an error in FreeImage syntax, code is similar as yours
Can you provide the entire correct code for steganograpghy
-
Apr 23rd, 2014, 08:15 PM
#6
Re: FreeImage.DLL GetPiexelColor
This thread is 7 years old mate. I doubt these folks are still posting. Why don't you make a new thread about your problem in the VB.Net section.
-
Apr 24th, 2014, 03:13 AM
#7
Re: FreeImage.DLL GetPiexelColor
Originally Posted by Wschmit
Along with value of the pixel, is saved in value, which is an RGB QUAD suggestion. You have to re-create this kind (I'm sure there's certification on the kind somewhere), then successfully pass a suggestion to it through the operate.
What the
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|