Your value(image) should by BytesWritable. YOu should cast like :
BytesWritable value = (BytesWritable)
ReflectionUtils.newInstance(reader.getValueClass(), confHadoop);
Second instead of Bytes.toBytes you should use copyBytes()
It give a copy of the bytes that is exactly the length of the data. So This should work
Configuration confHadoop = new Configuration();
FileSystem fs = FileSystem.get(confHadoop);
Path inPath = new Path("/home/Desktop/1.seq");
SequenceFile.Reader reader = new SequenceFile.Reader(fs, inPath, confHadoop);
//Name of your Image
Text key = (Text)
ReflectionUtils.newInstance(reader.getKeyClass(), confHadoop);
// Value -- mage
BytesWritable value = (BytesWritable)
ReflectionUtils.newInstance(reader.getValueClass(), confHadoop);
reader.next(key,value);
.......
byte[] b = copyBytes(value) ;
System.out.println((bImageFromConvert.toString()).length());
ImageIO.write(bImageFromConvert, "png", new File(
"/home/Desktop/imageAgain.png"));
}
}
That will do