|
Author |
Topic: jpeg from string? (Read 291 times) |
|
rgovostes
|
jpeg from string?
« on: Jan 5th, 2004, 2:48am » |
|
I am working on a sketch which utilizes the F5 steganography algorithm by Andreas Westfeld. From his site, you can download a Java implementation which saves the result as a JPEG. I am tying into the classes from the implementation, but as this will be running from the web, I cannot have it save the images. If I manage to reroute the output to a string, is it possible to have Processing load the image from it? (Alternatively I could just implement the algorithm myself, which is most likely what I will end up doing, so that I don't have to use JPEG stuff in the first place!)
|
« Last Edit: Jan 5th, 2004, 3:44am by rgovostes » |
|
|
|
|
fry
|
Re: jpeg from string?
« Reply #1 on: Jan 8th, 2004, 8:05pm » |
|
to make anything binary into an ascii string that works well for web transfer, use BASE64 encoding (check google for info about using java's built-in BASE64 classes). on the receiving end, decode the base64 string into a byte array of binary. pass that to java.awt.Toolkit.createImage() and you'll get a java "Image" back. (check the java docs for more info on createImage) next, construct a BImage from the java image via: BImage img = new BImage(imageFromPreviousStep); so it'll look something like (not sure on BASE64 syntax exactly): byte decodedBytes[] = BASE64Decoder.decode(theString); BImage img = new BImage(Toolkit.createImage(decodedBytes);
|
|
|
|
|