You Are Here:

Community: Developer Discussion Boards

#1 Old using jpg instead of png??? - 2003-10-07, 23:40

Join Date: Oct 2003
Posts: 41
Location: Pakistan, Karachi
farhanx
Offline
Registered User
hi! fullcanvas implement directgraphic support draw image and png format is work fine in it but doesnt drawimage method support this jpg or gif format??? when i used jpg instead of png it gives me error that it doesnt find jpg file why???
is in nokia series 40 sdk they allow only png format...
i hope ill get this answer :)

regards
farhan
Reply With Quote

#2 Old 2003-10-08, 12:27

Join Date: Mar 2003
Posts: 69
Location: Silicon Scally
bigredswitch
Offline
Dude!
The only image format MIDP1.0 devices are required to support is PNG, so having the ability to load, say, JPEG is optional. No S40 phone supports anything other than PNG, as far as I'm aware.

Carl.
Reply With Quote

#3 Old 2003-10-08, 13:12

Join Date: Mar 2003
Posts: 382
jalev's Avatar
jalev
Offline
Forum Nokia Expert
Hello

Actually you can draw JPEG images to the screen by using standard MIDP classes.
Image.createImage("/someimage.jpg")
Most propably old software version did not support this.
Reply With Quote

#4 Old 2003-10-08, 17:23

Join Date: Oct 2003
Posts: 41
Location: Pakistan, Karachi
farhanx
Offline
Registered User
hi! thanks for u guy's replies but if it does support these format then why i cant make it?

here is my code

public class farhan2 extends FullCanvas implements DirectGraphics {

public static String IMAGE_SOURCE
= "/com/borland/jbuilder/samples/micro/uidemo/Flag2.jpg";



//some other declared funtions etc etc


private void jbInit() throws Exception {
addCommand(new Command("Back", Command.BACK, 1));
try{
image = Image.createImage(IMAGE_SOURCE);
}
catch (java.io.IOException e) {
System.out.println(e.getMessage());
System.out.println("image not found");
}

}



protected void paint(Graphics g) {

DirectGraphics dg = DirectUtils.getDirectGraphics(g);
g.setColor(232,33,44);
g.drawLine(44,33,22,11);
dg.drawTriangle(33,22,11,66,54,33,422);
dg.fillTriangle(87,98,12,44,76,77,44);

//dg.drawImage(image,55,88,1,0);
g.drawImage(image,33,44,1);


}


}

i tried both from driectgraphic as well as from simple graphic mode but still doesnt work but png always works fine :(
Reply With Quote

#5 Old 2003-10-08, 18:18

Join Date: Mar 2003
Posts: 2,280
Location: Israel
shmoove
Offline
Forum Nokia Champion
If the problem was that the format is not supported it would probably give an error that says that, but you say:
Quote:
when i used jpg instead of png it gives me error that it doesnt find jpg file why???
so maybe the problem is as simple as that: it's not finding the file. Make sure the file exists in the path you specified, and that it's a valid file (if your code worked with a PNG image, I would put the JPEG in the same directory, and try from there).
Most of the time problems like these are just a matter of finding the file...
But then of course, maybe there really is no support for JPEGs. I know I have never tried displaying one. Why don't you just use a PNG.

shmoove
Reply With Quote

#6 Old 2003-10-09, 14:28

Join Date: Oct 2003
Posts: 41
Location: Pakistan, Karachi
farhanx
Offline
Registered User
no its no the problem of path just u also try to load jpg i guess they doesnt support jpg format ....cuz all path and every thing are set even i tried to load gif but couldnt saw anything at all so i guess only png format is supported for series 40 application work, maybe!!!!
Reply With Quote

#7 Old 2003-10-10, 19:11

Join Date: Jul 2003
Posts: 1,094
Location: Finland, Tampere
doctordwarf
Offline
Super Contributor
Check that image exists in the final JAR file and at the same path as *.png images you use

Some IDEs including JBuilder and Sun's Wireless toolkit automatically copy only severel file types into the JAR.
Of course, *.jpg is not among them.
Reply With Quote

#8 Old 2003-10-13, 17:12

Join Date: Oct 2003
Posts: 41
Location: Pakistan, Karachi
farhanx
Offline
Registered User
but still i dont get it what do u mean if its in jar or not because in jar file its showing only this

Manifest-Version: 1.0
MIDlet-Name: UIDemoMIDlet
MIDlet-1: UIDemoMidlet, /icons/ivanIcon.png, com.borland.jbuilder.samp
les.micro.uidemo.UIDemoMidlet
MIDlet-Icon: /icons/ivanIcon.png
MIDlet-Version: 1.0
MIDlet-Vendor: Borland Software Corporation
MicroEdition-Configuration: CLDC-1.0
MicroEdition-Profile: MIDP-1.0

so where i can define that it should read jpg i know i can make work withj png but if its avail as jpg then why i cant use it ? everything is on the same path where png file is exist ....
Reply With Quote

#9 Old 2003-10-13, 17:18

Join Date: Mar 2003
Posts: 2,280
Location: Israel
shmoove
Offline
Forum Nokia Champion
What you are describing is not a jar file, it's the jad file.
When you build an MIDP application you end up eith two files: the jad and the jar. The jad is the file you described in the previous post, and it contains general information about the application. The jar is the archive that contains the application itself (class files, resources, etc.). A jar file is actually no more than a zip file with a different extension, so you can open it with WinZip, or WinRAR, or the zip utility of your choice, and check if the jpg file is in there somewhere and what is the path to it.

shmoove
Reply With Quote

#10 Old 2003-10-13, 17:42

Join Date: Oct 2003
Posts: 41
Location: Pakistan, Karachi
farhanx
Offline
Registered User
hey thanks shmoove to reply me,
i checked the jar file by unzipping it and found the jpg picture same as how i am defining the path means no mistake i am doing at all, then now i am sure that it doesnt support gif and jpg ... but does all games build in nokia40 series with png picture format? cuz i really wana build the game ...

thanks alot again

farhan
Reply With Quote

#11 Old 2003-10-14, 10:07

Join Date: Mar 2003
Posts: 2,280
Location: Israel
shmoove
Offline
Forum Nokia Champion
Then just use PNGs then. That's what we all do. :)
Reply With Quote

#12 Old 2003-10-14, 13:47

Join Date: Jul 2003
Posts: 1,094
Location: Finland, Tampere
doctordwarf
Offline
Super Contributor
Not all of us :)

I use graphics preconverted to screen format to paint it ffffast! :)
And png for splash screen only
Reply With Quote

#13 Old 2003-10-14, 14:49

Join Date: Mar 2003
Posts: 2,280
Location: Israel
shmoove
Offline
Forum Nokia Champion
Now you're just showing off ;P
Reply With Quote

#14 Old Can java read .jpg and send to URL - 2003-10-15, 03:38

Join Date: Sep 2003
Posts: 26
chrise00
Offline
Registered User
Somewhat related to this, can Java on the 3650 read the JPG files created by the camera app?

I want to send .jpg files created by camera app (and therefore VGA quality versus what MMAPI offers) to a URL of mine..

Thanks

Chris
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

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 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ