[sane-devel] add support for ricoh aficio sp100su

viruxx dj_virus142 at hotmail.com
Sat Mar 11 21:55:17 UTC 2017


Path path = Paths.get("color.data");//raw data
    		byte[] buffer = Files.readAllBytes(path);
    		int passed=0;
    		int width = 2560;
    		int height = 3500;
    		BufferedImage img = new BufferedImage(width, height,
BufferedImage.TYPE_3BYTE_BGR);
    		for(int i = 0 ; i<buffer.length-(width*3) ; i++ ){//loop bytes one by
one
    			if(i%width == 0){i+=width*2;passed+=width*2;}//if 1 width line passed
jump 2 lines
    			int r = buffer[i]& 0xFF;//first byte
    			int g = buffer[i+width]& 0xFF;//second byte 1 line after
    			int b = buffer[i+width+width]& 0xFF;//third byte 2 lines after
    			Color color = new Color( g,b,r );//not rgb not rbg not grb not bgr
not brg but GBR xD 
    			img.setRGB((i-passed)%width, (i-passed)/width, color.getRGB()); //put
pixel at good place
    		}   
    		ImageIO.write(img, "png", new
File("realcolor.png")); //finally a real readable file <3
    	} catch (IOException ex) {  ex.printStackTrace();  }

//finally i got it , thanx to the one who helped me in webchat
//its a 1 line by color storage in GBR order

//here you got the first color scan of an aficio sp100su in linux :D
<nabble_img src="imagefinale.png" border="0"/>



--
View this message in context: http://sane.10972.n7.nabble.com/add-support-for-ricoh-aficio-sp100su-tp20705p20717.html
Sent from the SANE - Dev mailing list archive at Nabble.com.



More information about the sane-devel mailing list