i'm using JNA to work with a scanner's library "LSAPI.DLL" so, after the scan i get a frontimg parameter which is a Pointer of a Dib format, so i have to convert it to a Byte[] then convert the Byte[] to a bitmap and finally save the scanned image on my desktop to test.
this is the method that gave me the Pointer of the frontimg :
int a1 = lsApi.LSReadImage(hConnect.getValue(), fgWindow, LsApiConst.CLEAR_ALL_BLACK, (char) LsApiConst.SIDE_FRONT_IMAGE, LsApiConst.READMODE_BRUTTO, NrDoc, frontimg, backimg, R1, R2);
i tried to start with this but it doesn't work :
Pointer p = frontimg.getValue();
byte[] buffer = p.getByteArray(0, frontimg.getValue().SIZE);
BufferedImage img = ImageIO.read(new ByteArrayInputStream(buffer));
ImageIO.write(img,"BMP", new File("D:/image.BMP"));
System.out.println("image created");
is there any way to proceed ?