[sane-devel] add support for ricoh aficio sp100su

viruxx dj_virus142 at hotmail.com
Sat Mar 11 11:03:33 UTC 2017

ok today i worked with the data, i added this in the loop

  try { FileChannel channel = new FileOutputStream(new File("out.xml"),
true).getChannel(); //true = append data
							 channel.close(); } catch (Exception e) {e.printStackTrace(); }

with grayscale data i was able to have this

using this

try { 
    	    	FileInputStream fIn = new FileInputStream("out.xml");
    	    	FileChannel fChan = fIn.getChannel();
    	    	long fSize = fChan.size(); 
    	      ByteBuffer buffer = ByteBuffer.allocate((int) fSize);
    			DataBufferByte dbb = new DataBufferByte(buffer.array(),
    	          WritableRaster raster = Raster.createInterleavedRaster(dbb,
2560, 3501, 2560, 1, new int[]{0}, (Point) null); //i found w=2560 with a
little play in gimp, opening a raw file, indexed rgb selected
     	         //here size / 2560 = 3501
    	          ColorModel cm = new
ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_GRAY), false, true,
Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
    	          BufferedImage image = new BufferedImage(cm, raster, true,
    	          ImageIO.write(image, "png", new File("imagegray.png"));
    	      } catch (IOException ex) {  ex.printStackTrace();  }

for a color scan (size / 2560 = 10500) i have problem

trying this

   raster = Raster.createInterleavedRaster(dbb, 2560, 3500, 2560*3, 3, new
int[]{2,1,0}, (Point) null);
   cm = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
false, true, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);

gave me this

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

More information about the sane-devel mailing list