Hello,
Im looking for an example in how to create an Image from a string.
Any Suggestions?
Y
Hello,
Im looking for an example in how to create an Image from a string.
Any Suggestions?
Y
http://movi-az2.blogspot.com/
OK,
I have a Piece of String (Image) - which transfers via a servlet in XML.
after Getting the data from Server, i extract the data from the XML element into a String.
than keen of doing the followings:Code:pe = parser.read();
After this, it should create an Image object named "icon".Code:imageByteArray = Base64.decode(pe.getText()); imageLenght = imageByteArray.length; icon.createImage(imageByteArray, 0, imageLenght);
Then, i would like to put this Image object into RMS.
Please Advice.
Y
Last edited by bogdan.galiceanu; 2008-08-10 at 14:43.
Hi,
Didnt find any relative issue in your link, sorry...
My Use Case is :
- Get an String from an XML. it contains Image DATA.
- Somehow, Convert the data into An Image, with All relavent data like Width & Higth
- After Success, Add the Image into a RMS.
Thanks
Y
ypele, to me your use case sounds like it could be solved with the first link provied by bogdan galiceanu. Could you take a second look at that link..
If you are still sure that does not solve your problem, then maybe you should provide us with some example parts of the string you mention, so we could really understand your problem
Hartti
Hartti,
I have Manage to convert the string into an Image:
the issue begins when i like to get its WIDTH or HEIGHT( to add it into the RMS)Code:imageByteArray = Base64.decode(ImageString); imageLenght = imageByteArray.length; Image.createImage(imageByteArray, 0, imageLenght);
The code crashes with : java.lang.NullPointerExceptionCode:int height, width; height = icon.getHeight(); width = icon.getWidth();
Hi ypele,
from your Exception and your previous code, it seems that you're not correctly initializing the icon variable with the newly created Image.
For example, this line:
should look something like:Code:Image.createImage(imageByteArray, 0, imageLenght);
If you already do this, then you should consider about possible Exceptions thrown by the createImage method itself.Code:icon = Image.createImage(imageByteArray, 0, imageLenght);
Pit
ypele,
where do you create the icon object?
shouldn't this be
HarttiCode:icon = Image.createImage(imageByteArray, 0, imageLenght);
Hartti & Jappit,
Wicked!
previously i have creted the " Image icon object" but havent initiated it properly. your examples light the solution.
Thanks Mates.
Yaniv