[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.write(readed);
channel.close(); } catch (Exception e) {e.printStackTrace(); }
with grayscale data i was able to have this
<http://sane.10972.n7.nabble.com/file/n20716/imagegray.png>
using this
try {
FileInputStream fIn = new FileInputStream("out.xml");
FileChannel fChan = fIn.getChannel();
long fSize = fChan.size();
ByteBuffer buffer = ByteBuffer.allocate((int) fSize);
fChan.read(buffer);
buffer.rewind();
DataBufferByte dbb = new DataBufferByte(buffer.array(),
buffer.capacity());
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,
null);
ImageIO.write(image, "png", new File("imagegray.png"));
fIn.close();
} 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
<http://sane.10972.n7.nabble.com/file/n20716/color2.png>
--
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