Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
Super Contributor
Posts: 273
Registered: ‎11-23-2010
My Device: 9800 torch
My Carrier: Software Programmer
Accepted Solution

i got an error while converting an bitmap to jpeg

hi frends,

 

in my third party app.

i am uploading an image in jpeg format.

 

here i am getting an exception why i got this error

 

 JPEGEncodedImage image=(JPEGEncodedImage)EncodedImage.createEncodedImage(data,0,data.length);

 

IllegalArgumentException.

is this correct way to get the jpeg image.

 

please help me.

 

Thank you.

New Developer
Posts: 134
Registered: ‎01-11-2011
My Device: curve

Re: i got an error while converting an bitmap to jpeg

here image is a bitmap

JPEGEncodedImage jpg=JPEGEncodedImage.encode(image, 100);

 

 

press kudos if it helps

Trusted Contributor
Posts: 151
Registered: ‎06-17-2010
My Device: Curve 8900
My Carrier: Vodafone

Re: i got an error while converting an bitmap to jpeg

Hi bh1r1th,

 

Your syntax for encoading is wrong..

 

you have to try..

 

JPEGEncodedImage jpegencodedimage = JPEGEncodedImage.encode(bitmap, 80);

 


 

Don't Say Thank You... press the kudos button  on the right side to thank the user that helped you.

please mark posts as solved if you found a solution.

Developer
Posts: 105
Registered: ‎06-23-2010
My Device: 9000
My Carrier: vodaphone

Re: i got an error while converting an bitmap to jpeg

I have had issues doing this if the image was simply too big. How big is the JPEG?

 

 

-matt

Press Kudos if this helped - ;-)
Super Contributor
Posts: 273
Registered: ‎11-23-2010
My Device: 9800 torch
My Carrier: Software Programmer

Re: i got an error while converting an bitmap to jpeg

thank you for the replay

albert_anks

but that method is not available in 4.2 version.

 

i got the solution for that

 

check this post

 

http://supportforums.blackberry.com/t5/Java-Development/Jpeg-encoder-source-code-here/m-p/1022337

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: i got an error while converting an bitmap to jpeg

Good.  Can you  mark this as solved then?