Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

How to scale an image in J2ME?

 
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anyone has any idea how to scale an image in J2ME?
Does Graphics class and Image class provide any method to support the implementation of image scaling?
 
author
Posts: 1436
6
Python TypeScript Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No. The phone only has 100 KB of heap memory. Why would you waste it on oversized images? You should probably resize and optimize your images offline and then bundle them your application.
 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I could think of a few cases where you might want to scale down an image that was acquired on a camera phone using the MMAPI, for example in order to generate a thumbnail. In fact, I am working on such an application right now. The following article points out a simple way to do this:
http://developers.sun.com/techtopics/mobility/midp/articles/picture/
Check out the createThumbnail() example. In theory, this solution is not ideal, but it works fine for this purpose on my Nokia 3650.
With regards to scaling up you would need some real interpolation algorithm, so this would be more tricky. I'm not sure why anyone wouln need to do this, though.
Otherwise, I completely concur with Michael that you should do the scaling before and package the scaled images with your app.
-Mirko
 
Mirko Froehlich
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I could think of a few cases where you might want to scale down an image that was acquired on a camera phone using the MMAPI, for example in order to generate a thumbnail. In fact, I am working on such an application right now. The following article points out a simple way to do this:
Link
Check out the createThumbnail() example. In theory, this solution is not ideal, but it works fine for this purpose on my Nokia 3650.
With regards to scaling up you would need some real interpolation algorithm, so this would be more tricky. I'm not sure why anyone wouln need to do this, though.
Otherwise, I completely concur with Michael that you should do the scaling before and package the scaled images with your app.
-Mirko
 
Michael Yuan
author
Posts: 1436
6
Python TypeScript Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Someone needs to write a PNG parser and manipulation program for MIDP!
reply
    Bookmark Topic Watch Topic
  • New Topic