Hello,
I'm using VS2005 and writing a c# application for manipulating grayscale images in pgm format.
I managed to read the image from file to a GdPictureImaging object and display it in a Windows Form.
I now want to create a 2D array of the pixels' values. However, when I use GetPixelArray2D(ref imageArr,0,0,256,256), the resulting array's values are all very large negative values instead of 0-255 values.
Please help me convert a pgm image into a [0-255] 2d array
Thank you,
Moran Lefler
Getting grayscale values in array from a 8bpp image
Re: Getting grayscale values in array from a 8bpp image
Hi,
We added a method to do that within the last release: GetPixelArray8bpp1D()
See https://www.gdpicture.com/guides/gdpicture/v5/gdpictur ... bpp1D.html
A sample to apply negative effect using GetPixelArray8bpp1D() & SetPixelArray8bpp1D() methods:
Loïc
We added a method to do that within the last release: GetPixelArray8bpp1D()
See https://www.gdpicture.com/guides/gdpicture/v5/gdpictur ... bpp1D.html
A sample to apply negative effect using GetPixelArray8bpp1D() & SetPixelArray8bpp1D() methods:
Code: Select all
Dim arPixel() As Byte
Dim X As Long
Dim Y As Long
Call Imaging1.GetPixelArray8bpp1D(arPixel, 0, 0, Imaging1.GetWidth, Imaging1.GetHeight)
For X = 0 To object.GetWidth - 1
For Y = 0 To object.GetHeight - 1
arPixel((Y * Imaging1.GetWidth) + X) = Not arPixel((Y * Imaging1.GetWidth) + X)
Next Y
Next X
Call Imaging1.SetPixelArray8bpp1D(arPixel, 0, 0, Imaging1.GetWidth, Imaging1.GetHeight)
Loïc
Who is online
Users browsing this forum: Google [Bot] and 1 guest