You Are Here:

Community: Developer Discussion Boards

#1 Old Image Capture - 2008-12-09, 08:17

Join Date: Aug 2008
Posts: 167
mahesh_aquarius's Avatar
mahesh_aquarius
Offline
Regular Contributor
Is there any way to reduce the byte[] size in which the camera captured image is stored im encoding the byte array in to base64 binary and trying to send it to server.

or else can anyone suggest an alternative to send image to the server
Reply With Quote

#2 Old Re: Image Capture - 2008-12-09, 11:20

Join Date: Aug 2008
Posts: 167
mahesh_aquarius's Avatar
mahesh_aquarius
Offline
Regular Contributor
anyone can suggest how to send image to server successfully
Reply With Quote

#3 Old Re: Image Capture - 2008-12-10, 08:19

Join Date: Sep 2008
Posts: 200
Location: Ahmedabad
Send a message via Yahoo to sunil_bhambani123
sunil_bhambani123's Avatar
sunil_bhambani123
Offline
Regular Contributor
Hi,

Base64 alogrithm is more of a encoding rather than compression. Base64 makes sure that there is no loss of data in between.

If you want to reduce the size of images while transferring then one way is to reduce the resolution of the images captured that will automatically reduce the size of the images. Otherwise you may have to implement image compression algorithms such as Run length encoding or Huffman Coding.

In implementing the image compression algorithms make sure that the time taken by the algorithm should not be much otherwise it will be of no use I think.

Hope this information will help you.


Sunil
Software Developer - J2ME
Reply With Quote

#4 Old Thumbs up Re: Image Capture - 2008-12-11, 08:58

Join Date: Mar 2008
Posts: 2,161
Location: The Capital of I N D I A
Send a message via Skype™ to raj_J2ME
raj_J2ME's Avatar
raj_J2ME
Offline
Forum Nokia Champion
Hi Mahesh,
Following the suni post you can move forward with the code,
FileConnection fc = (FileConnection) Connector.open(”file://localhost/root1/path/to/file”);
if (!fc.exists())
{
throw new IOException(”File does not exists”);
}
InputStream fis = fc.openInputStream();

byte[] b = new byte[5000];
int length2 = fis.read(b, 0, 5000);

fis.close();
fc.close();

Now to avoid lose of data, we can apply base64 encoding like

String tempStr2 = new String(Base64.encode(fileBytes));

Note:- you may useany base64 class for this use but encoding and decoding should be synchronized no matter whatever is implementation technology on server

* Now we will build http connection and upload data on it

httpConnection = (HttpConnection) Connector.open(”http://Server/Address/to/target/script”);
httpConnection.setRequestMethod(HttpConnection.POST);
httpConnection.setRequestProperty(”User-Agent”, “Profile/MIDP-2.0 Configuration/CLDC-1.0″);
httpConnection.setRequestProperty(”Content-Language”, “en-US”);
httpConnection.setRequestProperty(”Content-Type”, “application/x-www-form-urlencoded”);
httpConnection.setRequestProperty(”Content-Length”, Integer.toString(data.length));

os = httpConnection.openOutputStream ();
os.write(data);
os.close();
httpConnection.close();

Thanks,


Thanks

R a j - The K e r n e l
Reply With Quote

#5 Old Re: Image Capture - 2008-12-11, 09:32

Join Date: Aug 2008
Posts: 167
mahesh_aquarius's Avatar
mahesh_aquarius
Offline
Regular Contributor
Hi raj

i tried the same http code but might some prblm in compatibility as our web service is written in .net also tried encoding the image in base 64 binary but in .net the decoded string is not exactly what we wanted

thnks
Reply With Quote

#6 Old Thumbs up Re: Image Capture - 2008-12-11, 10:24

Join Date: Mar 2008
Posts: 2,161
Location: The Capital of I N D I A
Send a message via Skype™ to raj_J2ME
raj_J2ME's Avatar
raj_J2ME
Offline
Forum Nokia Champion
Hi Mahesh,
Please discuss the same issue with your server side team,Check wjat they can do for you,in order to solve this issue,
Thanks,


Thanks

R a j - The K e r n e l
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Fast Image Capture Tobias_80 Symbian Media (Graphics & Sounds) 9 2007-06-18 13:29
Opening a JPEG Image ummarbhutta Mobile Java Media (Graphics & Sounds) 8 2007-02-15 07:34
how can i capture image with a background image mshouab Mobile Java Media (Graphics & Sounds) 3 2007-01-23 17:35
how to cut some part of Image mshouab Mobile Java Media (Graphics & Sounds) 2 2006-08-04 10:05
Nokia Image Converter davidpurdie General Discussion 0 2004-02-18 16:31

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia