Skip to main content

Image Size

14 replies [Last post]
Anonymous

I am trying to upload an image to a server and found that the size gets
larger after it is downloaded from the server and saved to RMS. When the
file is downloaded it is 13683 and then when it is written back it grows to
87450. The file is not uploaded correctly because it is larger, why is it
larger and is there anyway to keep the size the same, the jpg is 13683

Thanks

Load Image

ContentConnection connection = null;
DataInputStream iStrm = null;
ByteArrayOutputStream bStrm = null;
Image im = null;

connection = (ContentConnection) Connector.open(url);
iStrm = connection.openDataInputStream();

byte imageData[];
int length = (int) connection.getLength();
if (length != -1){
imageData = new byte[length];
iStrm.readFully(imageData);
} else {
bStrm = new ByteArrayOutputStream();
int ch;
while ((ch = iStrm.read()) != -1)
bStrm.write(ch);
imageData = bStrm.toByteArray();
bStrm.close();
}
System.out.println("download" + url + " " +
imageData.length); 13683
im = Image.createImage(imageData, 0, imageData.length);

Write to RMS

width = img.getWidth();
height = img.getHeight()
int[] imgRgbData = new int[width * height];
try {
img.getRGB(imgRgbData, 0, width, 0, 0, width, height);
} catch (Exception e) {
return Id;
}
System.out.println("img" + imgRgbData.length); 87450

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Chris Rotberg

It would seem that the RMS is going to be too small to save the images, I am
thinking about using the MicroSD on the phone. Have you had any experience
with saving to cards?

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Daniel Rocha
Sent: Thursday, March 15, 2007 11:53 AM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

Situation summary:

1) Dowload JPEG file into imageData[]
2) Create Image from it
3) Use getRGB to save it to RMS (this array is now uncompressed, raw data,
it's no longer JPEG)
4) Post it back to the server (raw data, not JPEG)
5) Read it on the server (raw data, has to be reencoded to JPEG before use)

Two solutions available:

1) Why don't you just save the imageData[] to the RMS? It will save you
time, memory and processing power. And it's in the correct format (JPEG).
2) Reencode the image to JPEG on the server, as after calling getRGB() you
no longer have compressed JPEG.

1) seems obvious to me.

Regards,
Daniel

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of ext Tim Chalk
Sent: Thursday, March 15, 2007 3:36 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

Do you still data of length 87450 once you have decoded it on the server?
This should still be a valid raw image.

What do you mean by not a valid file? You won't be able to treat it as a
jpg on the server unless you convert it back to jpg.

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Chris Rotberg
Sent: Thursday, March 15, 2007 2:23 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

I am ultimately trying to take pictures with the phone and then upload them
to the server. I have been using a test image jpg to download and then save
and then use getRGB to load and POST back to the server. The problem is the
getRGB image when POST back to the server doesn't work, maybe this just a
problem with jpg. I have been base64 encoding and then uploading and when I
decode it is not a valid file.

Has anyone tried uploading images to ASP.Net?

Thanks

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Tim Chalk
Sent: Thursday, March 15, 2007 11:05 AM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

The getRGB() call doesn't return a compressed jpg.

If you're concerned about the RMS size, then you would be better off storing
the byte array in RMS, then convert it to an image when you need it.

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Chris Rotberg
Sent: Thursday, March 15, 2007 1:51 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Image Size

I am trying to upload an image to a server and found that the size gets
larger after it is downloaded from the server and saved to RMS. When the
file is downloaded it is 13683 and then when it is written back it grows to
87450. The file is not uploaded correctly because it is larger, why is it
larger and is there anyway to keep the size the same, the jpg is 13683

Thanks

Load Image

ContentConnection connection = null;
DataInputStream iStrm = null;

ByteArrayOutputStream bStrm = null;

Image im = null;

connection = (ContentConnection) Connector.open(url);
iStrm = connection.openDataInputStream();

byte imageData[];
int length = (int) connection.getLength();
if (length != -1){
imageData = new byte[length];
iStrm.readFully(imageData);
} else {
bStrm = new ByteArrayOutputStream();
int ch;
while ((ch = iStrm.read()) != -1)
bStrm.write(ch);
imageData = bStrm.toByteArray();
bStrm.close();
}
System.out.println("download" + url + " " +
imageData.length); 13683
im = Image.createImage(imageData, 0, imageData.length);

Write to RMS

width = img.getWidth();

height = img.getHeight()

int[] imgRgbData = new int[width * height];
try {
img.getRGB(imgRgbData, 0, width, 0, 0, width, height);
} catch (Exception e) {
return Id;
}
System.out.println("img" + imgRgbData.length); 87450

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Joe Bowbeer

RMS should be OK for saving a few small snapshots in JPG format.

For saving to MicroSD, you'll need a signed MIDlet -- for almost all
practical purposes. I think this is true even on the Nextel handsets,
which are the Swiss Army Knife of ME handsets...

Btw, the Sony Ericsson JP-7 handsets implement JSR-234's
SnapshotControl, which can automatically store captured images to the
file system. This makes a lot of sense.

In answer to another question: I have uploaded images to .NET. Since
very few .NET servers are communicating with MIDlets these days, .NET
it is a bit more difficult to use than say Tomcat, but it can be done.

On 3/15/07, Chris Rotberg wrote:
>
> It would seem that the RMS is going to be too small to save the images, I am
> thinking about using the MicroSD on the phone. Have you had any experience
> with saving to cards?
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Daniel Rocha

Situation summary:

1) Dowload JPEG file into imageData[]
2) Create Image from it
3) Use getRGB to save it to RMS (this array is now uncompressed, raw
data, it's no longer JPEG)
4) Post it back to the server (raw data, not JPEG)
5) Read it on the server (raw data, has to be reencoded to JPEG before
use)

Two solutions available:

1) Why don't you just save the imageData[] to the RMS? It will save you
time, memory and processing power. And it's in the correct format
(JPEG).
2) Reencode the image to JPEG on the server, as after calling getRGB()
you no longer have compressed JPEG.

1) seems obvious to me.

Regards,
Daniel

________________________________

From: A mailing list for KVM discussion
[mailto:KVM-INTEREST@JAVA.SUN.COM] On Behalf Of ext Tim Chalk
Sent: Thursday, March 15, 2007 3:36 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

Do you still data of length 87450 once you have decoded it on the
server? This should still be a valid raw image.

What do you mean by not a valid file? You won't be able to treat it as
a jpg on the server unless you convert it back to jpg.

________________________________

From: A mailing list for KVM discussion
[mailto:KVM-INTEREST@JAVA.SUN.COM] On Behalf Of Chris Rotberg
Sent: Thursday, March 15, 2007 2:23 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

I am ultimately trying to take pictures with the phone and then upload
them to the server. I have been using a test image jpg to download and
then save and then use getRGB to load and POST back to the server. The
problem is the getRGB image when POST back to the server doesn't work,
maybe this just a problem with jpg. I have been base64 encoding and then
uploading and when I decode it is not a valid file.

Has anyone tried uploading images to ASP.Net?

Thanks

________________________________

From: A mailing list for KVM discussion
[mailto:KVM-INTEREST@JAVA.SUN.COM] On Behalf Of Tim Chalk
Sent: Thursday, March 15, 2007 11:05 AM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

The getRGB() call doesn't return a compressed jpg.

If you're concerned about the RMS size, then you would be better off
storing the byte array in RMS, then convert it to an image when you need
it.

________________________________

From: A mailing list for KVM discussion
[mailto:KVM-INTEREST@JAVA.SUN.COM] On Behalf Of Chris Rotberg
Sent: Thursday, March 15, 2007 1:51 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Image Size

I am trying to upload an image to a server and found that the size gets
larger after it is downloaded from the server and saved to RMS. When the
file is downloaded it is 13683 and then when it is written back it grows
to 87450. The file is not uploaded correctly because it is larger, why
is it larger and is there anyway to keep the size the same, the jpg is
13683

Thanks

Load Image

ContentConnection connection = null;
DataInputStream iStrm = null;

ByteArrayOutputStream bStrm = null;

Image im = null;

connection = (ContentConnection) Connector.open(url);
iStrm = connection.openDataInputStream();

byte imageData[];
int length = (int) connection.getLength();
if (length != -1){
imageData = new byte[length];
iStrm.readFully(imageData);
} else {
bStrm = new ByteArrayOutputStream();
int ch;
while ((ch = iStrm.read()) != -1)
bStrm.write(ch);
imageData = bStrm.toByteArray();
bStrm.close();
}
System.out.println("download" + url + " " +
imageData.length); 13683
im = Image.createImage(imageData, 0, imageData.length);

Write to RMS

width = img.getWidth();

height = img.getHeight()

int[] imgRgbData = new int[width * height];
try {
img.getRGB(imgRgbData, 0, width, 0, 0, width, height);
} catch (Exception e) {
return Id;
}
System.out.println("img" + imgRgbData.length); 87450

========================================================================
=== To unsubscribe, send email to listserv@java.sun.com and include in
the body of the message "signoff KVM-INTEREST". For general help, send
email to listserv@java.sun.com and include in the body of the message
"help".
========================================================================
=== To unsubscribe, send email to listserv@java.sun.com and include in
the body of the message "signoff KVM-INTEREST". For general help, send
email to listserv@java.sun.com and include in the body of the message
"help".

========================================================================
=== To unsubscribe, send email to listserv@java.sun.com and include in
the body of the message "signoff KVM-INTEREST". For general help, send
email to listserv@java.sun.com and include in the body of the message
"help".
========================================================================
=== To unsubscribe, send email to listserv@java.sun.com and include in
the body of the message "signoff KVM-INTEREST". For general help, send
email to listserv@java.sun.com and include in the body of the message
"help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Chris Rotberg

I have done that, my issue was converting back to jpg on the server, ASP.Net
is not converting correclty. I am going to change to a png and follow the
same steps

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Daniel Rocha
Sent: Thursday, March 15, 2007 11:53 AM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

Situation summary:

1) Dowload JPEG file into imageData[]
2) Create Image from it
3) Use getRGB to save it to RMS (this array is now uncompressed, raw data,
it's no longer JPEG)
4) Post it back to the server (raw data, not JPEG)
5) Read it on the server (raw data, has to be reencoded to JPEG before use)

Two solutions available:

1) Why don't you just save the imageData[] to the RMS? It will save you
time, memory and processing power. And it's in the correct format (JPEG).
2) Reencode the image to JPEG on the server, as after calling getRGB() you
no longer have compressed JPEG.

1) seems obvious to me.

Regards,
Daniel

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of ext Tim Chalk
Sent: Thursday, March 15, 2007 3:36 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

Do you still data of length 87450 once you have decoded it on the server?
This should still be a valid raw image.

What do you mean by not a valid file? You won't be able to treat it as a
jpg on the server unless you convert it back to jpg.

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Chris Rotberg
Sent: Thursday, March 15, 2007 2:23 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

I am ultimately trying to take pictures with the phone and then upload them
to the server. I have been using a test image jpg to download and then save
and then use getRGB to load and POST back to the server. The problem is the
getRGB image when POST back to the server doesn't work, maybe this just a
problem with jpg. I have been base64 encoding and then uploading and when I
decode it is not a valid file.

Has anyone tried uploading images to ASP.Net?

Thanks

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Tim Chalk
Sent: Thursday, March 15, 2007 11:05 AM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

The getRGB() call doesn't return a compressed jpg.

If you're concerned about the RMS size, then you would be better off storing
the byte array in RMS, then convert it to an image when you need it.

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Chris Rotberg
Sent: Thursday, March 15, 2007 1:51 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Image Size

I am trying to upload an image to a server and found that the size gets
larger after it is downloaded from the server and saved to RMS. When the
file is downloaded it is 13683 and then when it is written back it grows to
87450. The file is not uploaded correctly because it is larger, why is it
larger and is there anyway to keep the size the same, the jpg is 13683

Thanks

Load Image

ContentConnection connection = null;
DataInputStream iStrm = null;

ByteArrayOutputStream bStrm = null;

Image im = null;

connection = (ContentConnection) Connector.open(url);
iStrm = connection.openDataInputStream();

byte imageData[];
int length = (int) connection.getLength();
if (length != -1){
imageData = new byte[length];
iStrm.readFully(imageData);
} else {
bStrm = new ByteArrayOutputStream();
int ch;
while ((ch = iStrm.read()) != -1)
bStrm.write(ch);
imageData = bStrm.toByteArray();
bStrm.close();
}
System.out.println("download" + url + " " +
imageData.length); 13683
im = Image.createImage(imageData, 0, imageData.length);

Write to RMS

width = img.getWidth();

height = img.getHeight()

int[] imgRgbData = new int[width * height];
try {
img.getRGB(imgRgbData, 0, width, 0, 0, width, height);
} catch (Exception e) {
return Id;
}
System.out.println("img" + imgRgbData.length); 87450

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Tim Chalk

Do you still data of length 87450 once you have decoded it on the
server? This should still be a valid raw image.

What do you mean by not a valid file? You won't be able to treat it as
a jpg on the server unless you convert it back to jpg.

________________________________

From: A mailing list for KVM discussion
[mailto:KVM-INTEREST@JAVA.SUN.COM] On Behalf Of Chris Rotberg
Sent: Thursday, March 15, 2007 2:23 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

I am ultimately trying to take pictures with the phone and then upload
them to the server. I have been using a test image jpg to download and
then save and then use getRGB to load and POST back to the server. The
problem is the getRGB image when POST back to the server doesn't work,
maybe this just a problem with jpg. I have been base64 encoding and then
uploading and when I decode it is not a valid file.

Has anyone tried uploading images to ASP.Net?

Thanks

________________________________

From: A mailing list for KVM discussion
[mailto:KVM-INTEREST@JAVA.SUN.COM] On Behalf Of Tim Chalk
Sent: Thursday, March 15, 2007 11:05 AM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

The getRGB() call doesn't return a compressed jpg.

If you're concerned about the RMS size, then you would be better off
storing the byte array in RMS, then convert it to an image when you need
it.

________________________________

From: A mailing list for KVM discussion
[mailto:KVM-INTEREST@JAVA.SUN.COM] On Behalf Of Chris Rotberg
Sent: Thursday, March 15, 2007 1:51 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Image Size

I am trying to upload an image to a server and found that the size gets
larger after it is downloaded from the server and saved to RMS. When the
file is downloaded it is 13683 and then when it is written back it grows
to 87450. The file is not uploaded correctly because it is larger, why
is it larger and is there anyway to keep the size the same, the jpg is
13683

Thanks

Load Image

ContentConnection connection = null;
DataInputStream iStrm = null;

ByteArrayOutputStream bStrm = null;

Image im = null;

connection = (ContentConnection) Connector.open(url);
iStrm = connection.openDataInputStream();

byte imageData[];
int length = (int) connection.getLength();
if (length != -1){
imageData = new byte[length];
iStrm.readFully(imageData);
} else {
bStrm = new ByteArrayOutputStream();
int ch;
while ((ch = iStrm.read()) != -1)
bStrm.write(ch);
imageData = bStrm.toByteArray();
bStrm.close();
}
System.out.println("download" + url + " " +
imageData.length); 13683
im = Image.createImage(imageData, 0, imageData.length);

Write to RMS

width = img.getWidth();

height = img.getHeight()

int[] imgRgbData = new int[width * height];
try {
img.getRGB(imgRgbData, 0, width, 0, 0, width, height);
} catch (Exception e) {
return Id;
}
System.out.println("img" + imgRgbData.length); 87450

========================================================================
=== To unsubscribe, send email to listserv@java.sun.com and include in
the body of the message "signoff KVM-INTEREST". For general help, send
email to listserv@java.sun.com and include in the body of the message
"help".
========================================================================
=== To unsubscribe, send email to listserv@java.sun.com and include in
the body of the message "signoff KVM-INTEREST". For general help, send
email to listserv@java.sun.com and include in the body of the message
"help".

========================================================================
=== To unsubscribe, send email to listserv@java.sun.com and include in
the body of the message "signoff KVM-INTEREST". For general help, send
email to listserv@java.sun.com and include in the body of the message
"help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Chris Rotberg

That is what I am finding out, I need to convert it back to a jpg on ASP, I
am looking for some code. I am using Motorola Nextel phones and I cannot set
the image type, it uses a default which I think it png. I was using jpg for
testing, how can I find out what types are supported on the phone so I know
how to convert it?

Thanks

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Tim Chalk
Sent: Thursday, March 15, 2007 11:36 AM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

Do you still data of length 87450 once you have decoded it on the server?
This should still be a valid raw image.

What do you mean by not a valid file? You won't be able to treat it as a
jpg on the server unless you convert it back to jpg.

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Chris Rotberg
Sent: Thursday, March 15, 2007 2:23 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

I am ultimately trying to take pictures with the phone and then upload them
to the server. I have been using a test image jpg to download and then save
and then use getRGB to load and POST back to the server. The problem is the
getRGB image when POST back to the server doesn't work, maybe this just a
problem with jpg. I have been base64 encoding and then uploading and when I
decode it is not a valid file.

Has anyone tried uploading images to ASP.Net?

Thanks

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Tim Chalk
Sent: Thursday, March 15, 2007 11:05 AM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

The getRGB() call doesn't return a compressed jpg.

If you're concerned about the RMS size, then you would be better off storing
the byte array in RMS, then convert it to an image when you need it.

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Chris Rotberg
Sent: Thursday, March 15, 2007 1:51 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Image Size

I am trying to upload an image to a server and found that the size gets
larger after it is downloaded from the server and saved to RMS. When the
file is downloaded it is 13683 and then when it is written back it grows to
87450. The file is not uploaded correctly because it is larger, why is it
larger and is there anyway to keep the size the same, the jpg is 13683

Thanks

Load Image

ContentConnection connection = null;
DataInputStream iStrm = null;

ByteArrayOutputStream bStrm = null;

Image im = null;

connection = (ContentConnection) Connector.open(url);
iStrm = connection.openDataInputStream();

byte imageData[];
int length = (int) connection.getLength();
if (length != -1){
imageData = new byte[length];
iStrm.readFully(imageData);
} else {
bStrm = new ByteArrayOutputStream();
int ch;
while ((ch = iStrm.read()) != -1)
bStrm.write(ch);
imageData = bStrm.toByteArray();
bStrm.close();
}
System.out.println("download" + url + " " +
imageData.length); 13683
im = Image.createImage(imageData, 0, imageData.length);

Write to RMS

width = img.getWidth();

height = img.getHeight()

int[] imgRgbData = new int[width * height];
try {
img.getRGB(imgRgbData, 0, width, 0, 0, width, height);
} catch (Exception e) {
return Id;
}
System.out.println("img" + imgRgbData.length); 87450

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Joe Bowbeer

On 3/15/07, Chris Rotberg wrote:
>
> how can I find out what types are supported on the phone so I know
> how to convert it?
>

This returns the available snapshot formats:

String encodings = System.getProperty("video.snapshot.encodings");

These days, the default snapshot encoding for handsets with decent
cameras is JPEG.

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Chris Rotberg

Thanks

-----Original Message-----
From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Joe Bowbeer
Sent: Thursday, March 15, 2007 1:07 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

On 3/15/07, Chris Rotberg wrote:
>
> how can I find out what types are supported on the phone so I know how
> to convert it?
>

This returns the available snapshot formats:

String encodings = System.getProperty("video.snapshot.encodings");

These days, the default snapshot encoding for handsets with decent cameras
is JPEG.

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Thomas Landspurg

You can also look at the open source project mobup, and eventually
contribute to it! It's a picture uploader to flickr, with some geotagging
capacities

http://mobup.sourceforge.net

On 3/15/07, Chris Rotberg wrote:
>
> Thanks
>
> -----Original Message-----
> From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
> On Behalf Of Joe Bowbeer
> Sent: Thursday, March 15, 2007 1:07 PM
> To: KVM-INTEREST@JAVA.SUN.COM
> Subject: Re: Image Size
>
> On 3/15/07, Chris Rotberg wrote:
> >
> > how can I find out what types are supported on the phone so I know how
> > to convert it?
> >
>
> This returns the available snapshot formats:
>
> String encodings = System.getProperty("video.snapshot.encodings");
>
> These days, the default snapshot encoding for handsets with decent cameras
> is JPEG.
>
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the
> body
> of the message "signoff KVM-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".
>
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the
> body
> of the message "signoff KVM-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".
>

--
Thomas Landspurg
http://blog.landspurg.net

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Tim Chalk

The getRGB() call doesn't return a compressed jpg.

If you're concerned about the RMS size, then you would be better off
storing the byte array in RMS, then convert it to an image when you need
it.

________________________________

From: A mailing list for KVM discussion
[mailto:KVM-INTEREST@JAVA.SUN.COM] On Behalf Of Chris Rotberg
Sent: Thursday, March 15, 2007 1:51 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Image Size

I am trying to upload an image to a server and found that the size gets
larger after it is downloaded from the server and saved to RMS. When the
file is downloaded it is 13683 and then when it is written back it grows
to 87450. The file is not uploaded correctly because it is larger, why
is it larger and is there anyway to keep the size the same, the jpg is
13683

Thanks

Load Image

ContentConnection connection = null;
DataInputStream iStrm = null;

ByteArrayOutputStream bStrm = null;

Image im = null;

connection = (ContentConnection) Connector.open(url);
iStrm = connection.openDataInputStream();

byte imageData[];
int length = (int) connection.getLength();
if (length != -1){
imageData = new byte[length];
iStrm.readFully(imageData);
} else {
bStrm = new ByteArrayOutputStream();
int ch;
while ((ch = iStrm.read()) != -1)
bStrm.write(ch);
imageData = bStrm.toByteArray();
bStrm.close();
}
System.out.println("download" + url + " " +
imageData.length); 13683
im = Image.createImage(imageData, 0, imageData.length);

Write to RMS

width = img.getWidth();

height = img.getHeight()

int[] imgRgbData = new int[width * height];
try {
img.getRGB(imgRgbData, 0, width, 0, 0, width, height);
} catch (Exception e) {
return Id;
}
System.out.println("img" + imgRgbData.length); 87450

========================================================================
=== To unsubscribe, send email to listserv@java.sun.com and include in
the body of the message "signoff KVM-INTEREST". For general help, send
email to listserv@java.sun.com and include in the body of the message
"help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Chris Rotberg

I am ultimately trying to take pictures with the phone and then upload them
to the server. I have been using a test image jpg to download and then save
and then use getRGB to load and POST back to the server. The problem is the
getRGB image when POST back to the server doesn't work, maybe this just a
problem with jpg. I have been base64 encoding and then uploading and when I
decode it is not a valid file.

Has anyone tried uploading images to ASP.Net?

Thanks

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Tim Chalk
Sent: Thursday, March 15, 2007 11:05 AM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

The getRGB() call doesn't return a compressed jpg.

If you're concerned about the RMS size, then you would be better off storing
the byte array in RMS, then convert it to an image when you need it.

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Chris Rotberg
Sent: Thursday, March 15, 2007 1:51 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Image Size

I am trying to upload an image to a server and found that the size gets
larger after it is downloaded from the server and saved to RMS. When the
file is downloaded it is 13683 and then when it is written back it grows to
87450. The file is not uploaded correctly because it is larger, why is it
larger and is there anyway to keep the size the same, the jpg is 13683

Thanks

Load Image

ContentConnection connection = null;
DataInputStream iStrm = null;

ByteArrayOutputStream bStrm = null;

Image im = null;

connection = (ContentConnection) Connector.open(url);
iStrm = connection.openDataInputStream();

byte imageData[];
int length = (int) connection.getLength();
if (length != -1){
imageData = new byte[length];
iStrm.readFully(imageData);
} else {
bStrm = new ByteArrayOutputStream();
int ch;
while ((ch = iStrm.read()) != -1)
bStrm.write(ch);
imageData = bStrm.toByteArray();
bStrm.close();
}
System.out.println("download" + url + " " +
imageData.length); 13683
im = Image.createImage(imageData, 0, imageData.length);

Write to RMS

width = img.getWidth();

height = img.getHeight()

int[] imgRgbData = new int[width * height];
try {
img.getRGB(imgRgbData, 0, width, 0, 0, width, height);
} catch (Exception e) {
return Id;
}
System.out.println("img" + imgRgbData.length); 87450

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Jonathan Simon

Just a thought... Is there any reason you're using JPEGs rather than
PNGs? I know PNG is the desired ME format and different handsets may be
optimized for PNGs and potentially not support JPEG at all. That could
be the cause of some weirdness.

-jonathan

________________________________

From: A mailing list for KVM discussion
[mailto:KVM-INTEREST@JAVA.SUN.COM] On Behalf Of Chris Rotberg
Sent: Thursday, March 15, 2007 11:23 AM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

I am ultimately trying to take pictures with the phone and then upload
them to the server. I have been using a test image jpg to download and
then save and then use getRGB to load and POST back to the server. The
problem is the getRGB image when POST back to the server doesn't work,
maybe this just a problem with jpg. I have been base64 encoding and then
uploading and when I decode it is not a valid file.

Has anyone tried uploading images to ASP.Net?

Thanks

________________________________

From: A mailing list for KVM discussion
[mailto:KVM-INTEREST@JAVA.SUN.COM] On Behalf Of Tim Chalk
Sent: Thursday, March 15, 2007 11:05 AM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

The getRGB() call doesn't return a compressed jpg.

If you're concerned about the RMS size, then you would be better off
storing the byte array in RMS, then convert it to an image when you need
it.

________________________________

From: A mailing list for KVM discussion
[mailto:KVM-INTEREST@JAVA.SUN.COM] On Behalf Of Chris Rotberg
Sent: Thursday, March 15, 2007 1:51 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Image Size

I am trying to upload an image to a server and found that the size gets
larger after it is downloaded from the server and saved to RMS. When the
file is downloaded it is 13683 and then when it is written back it grows
to 87450. The file is not uploaded correctly because it is larger, why
is it larger and is there anyway to keep the size the same, the jpg is
13683

Thanks

Load Image

ContentConnection connection = null;
DataInputStream iStrm = null;

ByteArrayOutputStream bStrm = null;

Image im = null;

connection = (ContentConnection) Connector.open(url);
iStrm = connection.openDataInputStream();

byte imageData[];
int length = (int) connection.getLength();
if (length != -1){
imageData = new byte[length];
iStrm.readFully(imageData);
} else {
bStrm = new ByteArrayOutputStream();
int ch;
while ((ch = iStrm.read()) != -1)
bStrm.write(ch);
imageData = bStrm.toByteArray();
bStrm.close();
}
System.out.println("download" + url + " " +
imageData.length); 13683
im = Image.createImage(imageData, 0, imageData.length);

Write to RMS

width = img.getWidth();

height = img.getHeight()

int[] imgRgbData = new int[width * height];
try {
img.getRGB(imgRgbData, 0, width, 0, 0, width, height);
} catch (Exception e) {
return Id;
}
System.out.println("img" + imgRgbData.length); 87450

========================================================================
=== To unsubscribe, send email to listserv@java.sun.com and include in
the body of the message "signoff KVM-INTEREST". For general help, send
email to listserv@java.sun.com and include in the body of the message
"help".
========================================================================
=== To unsubscribe, send email to listserv@java.sun.com and include in
the body of the message "signoff KVM-INTEREST". For general help, send
email to listserv@java.sun.com and include in the body of the message
"help".

========================================================================
=== To unsubscribe, send email to listserv@java.sun.com and include in
the body of the message "signoff KVM-INTEREST". For general help, send
email to listserv@java.sun.com and include in the body of the message
"help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Chris Rotberg

I was just testing, I need to try png instead. I was reading an article that
said jpg was faster and smaller than png

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Jonathan Simon
Sent: Thursday, March 15, 2007 11:27 AM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

Just a thought. Is there any reason you're using JPEGs rather than PNGs? I
know PNG is the desired ME format and different handsets may be optimized
for PNGs and potentially not support JPEG at all. That could be the cause of
some weirdness.

-jonathan

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Chris Rotberg
Sent: Thursday, March 15, 2007 11:23 AM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

I am ultimately trying to take pictures with the phone and then upload them
to the server. I have been using a test image jpg to download and then save
and then use getRGB to load and POST back to the server. The problem is the
getRGB image when POST back to the server doesn't work, maybe this just a
problem with jpg. I have been base64 encoding and then uploading and when I
decode it is not a valid file.

Has anyone tried uploading images to ASP.Net?

Thanks

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Tim Chalk
Sent: Thursday, March 15, 2007 11:05 AM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Image Size

The getRGB() call doesn't return a compressed jpg.

If you're concerned about the RMS size, then you would be better off storing
the byte array in RMS, then convert it to an image when you need it.

_____

From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Chris Rotberg
Sent: Thursday, March 15, 2007 1:51 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Image Size

I am trying to upload an image to a server and found that the size gets
larger after it is downloaded from the server and saved to RMS. When the
file is downloaded it is 13683 and then when it is written back it grows to
87450. The file is not uploaded correctly because it is larger, why is it
larger and is there anyway to keep the size the same, the jpg is 13683

Thanks

Load Image

ContentConnection connection = null;
DataInputStream iStrm = null;

ByteArrayOutputStream bStrm = null;

Image im = null;

connection = (ContentConnection) Connector.open(url);
iStrm = connection.openDataInputStream();

byte imageData[];
int length = (int) connection.getLength();
if (length != -1){
imageData = new byte[length];
iStrm.readFully(imageData);
} else {
bStrm = new ByteArrayOutputStream();
int ch;
while ((ch = iStrm.read()) != -1)
bStrm.write(ch);
imageData = bStrm.toByteArray();
bStrm.close();
}
System.out.println("download" + url + " " +
imageData.length); 13683
im = Image.createImage(imageData, 0, imageData.length);

Write to RMS

width = img.getWidth();

height = img.getHeight()

int[] imgRgbData = new int[width * height];
try {
img.getRGB(imgRgbData, 0, width, 0, 0, width, height);
} catch (Exception e) {
return Id;
}
System.out.println("img" + imgRgbData.length); 87450

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Joe Bowbeer

JPEG is compressed

img.getRGB is raw uncompressed image data

On 3/15/07, Chris Rotberg wrote:
>
> I am trying to upload an image to a server and found that the size gets
> larger after it is downloaded from the server and saved to RMS. When the
> file is downloaded it is 13683 and then when it is written back it grows to
> 87450. The file is not uploaded correctly because it is larger, why is it
> larger and is there anyway to keep the size the same, the jpg is 13683
>
> Thanks
>
> Load Image
>
> ContentConnection connection = null;
> DataInputStream iStrm = null;
> ByteArrayOutputStream bStrm = null;
> Image im = null;
>
> connection = (ContentConnection) Connector.open(url);
> iStrm = connection.openDataInputStream();
>
> byte imageData[];
> int length = (int) connection.getLength();
> if (length != -1){
> imageData = new byte[length];
> iStrm.readFully(imageData);
> } else {
> bStrm = new ByteArrayOutputStream();
> int ch;
> while ((ch = iStrm.read()) != -1)
> bStrm.write(ch);
> imageData = bStrm.toByteArray();
> bStrm.close();
> }
> System.out.println("download" + url + " " +
> imageData.length); 13683
> im = Image.createImage(imageData, 0, imageData.length);
>
>
> Write to RMS
>
> width = img.getWidth();
> height = img.getHeight()
> int[] imgRgbData = new int[width * height];
> try {
> img.getRGB(imgRgbData, 0, width, 0, 0, width, height);
> } catch (Exception e) {
> return Id;
> }
> System.out.println("img" + imgRgbData.length); 87450
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".