Closed GoogleCodeExporter closed 8 years ago
How do you read the image? into a InputStream? What DB id it?
if so, the thing now is convert from Inputstream to BufferedImage.
I didn't google hard but it is possible. Give it a shot if you want. This
functionality would be very handy.
Classe Image in java2word converts a "java.awt.image.BufferedImage" to
Hexadecimal. So if you find out how to get it into a BufferedImage the rest is
easy.
Thanks for the suggestion. I don't have any example image in a database now.
cheers
Leonardo
Original comment by leonardo...@gmail.com
on 15 Feb 2012 at 1:10
I have byte[], but it is not problem do a InputStream.
Now i just sort it out.
I explored your source and found out it is quite easy. I added other private
Image constructor with 2 params - Image(String filename, InputStream is) and
static method and static method from_STREAM(String filename, InputStream
inputStream).
But would be much better it would be done on your side, due to future
compatibility. And of course it can be useful for other.
Thanks for your reply.
Original comment by trumb...@gmail.com
on 15 Feb 2012 at 1:31
send me a patch and I apply to the code.
thanks a lot
Original comment by leonardo...@gmail.com
on 15 Feb 2012 at 1:58
Here are both new methods.
Thanks.
private Image(String filename, InputStream inputStream) {
if (inputStream == null)
throw new IllegalArgumentException("Can't create image - null input stream");
if (filename == null || filename.length() < 3)
throw new IllegalArgumentException("Can't create image - invalid filename");
this.path = filename;
try {
this.bufferedImage = ImageIO.read(inputStream);
} catch (IOException e) {
throw new RuntimeException("Can't create ImageIO.", e);
}
}
public static Image from_STREAM(String filename, InputStream inputStream)
{
return new Image(filename, inputStream);
}
Original comment by trumb...@gmail.com
on 15 Feb 2012 at 2:16
in progress
Original comment by leonardo...@gmail.com
on 16 Feb 2012 at 12:38
This will be available in the next 3.2 JAR version. Obviously code has been
committed and unit test written. thanks a lot for your contribution.
Original comment by leonardo...@gmail.com
on 16 Feb 2012 at 1:22
Original comment by leonardo...@gmail.com
on 16 Feb 2012 at 10:43
Original issue reported on code.google.com by
trumb...@gmail.com
on 15 Feb 2012 at 8:42