Can we resize the image in j2me so that bigger dimention image can fit into the mobile screen. My actual task in to zoom in and out the image [ February 23, 2005: Message edited by: Praveen india ]
Michael Yuan
author
Ranch Hand
Joined: Mar 07, 2002
Posts: 1427
posted
You cannot resize the in-memory image unless you understand the encoding algorithm. But when you draw the image on screen, you can map each screen pixel to several pixels on the image -- effectively smooth it and reduce its display size.
Here is a piece of code I use to display a resized image. Hope it helps.
Let's make this great code more readable using CODE tags. - Mark [ May 15, 2005: Message edited by: Mark Spritzler ]
Praveen india
Greenhorn
Joined: Feb 23, 2005
Posts: 7
posted
Thank you Jari Kemppinen for this code, Now my problem is that when I make bigger picture to Thumbnail image it works fine, the quality of picture is also good, but when I use the same method in which I passed Thumbnail image as parameter and changed the thumbWidth,thumbHeight values,to get the bigger image the quality of picture is not good. But if I use the original image to fit the screen I am getting java.lang.OutOfMemoryError if the image is bigger the screen size. if the image is small the screen size, so the error dosen't cum can u help me [ February 24, 2005: Message edited by: Praveen india ]
Nitin India
Greenhorn
Joined: Feb 24, 2005
Posts: 2
posted
Hi Jari,
tht code was really gud, but i have one query when i tried this code on transparent image it showed me white pixels on transparent area.
can i remove these these white pixels.
thnks
Jari Kemppinen
Ranch Hand
Joined: Nov 28, 2004
Posts: 34
posted
Sorry I can't help you guys any further, haven't got time to look into the problems you are having. If you find a solution please post it up to help other people with similar problems.
Nitin India
Greenhorn
Joined: Feb 24, 2005
Posts: 2
posted
Hi all..
can any one help. i hv same question which i asked in my previous post.
though i hv done few things but was unsuccessful. its related to changing a alpha channel in a png image using nokia UI API.
can some one help.
thnks
ApxA Corporation
Greenhorn
Joined: May 14, 2005
Posts: 1
posted
Hello, I try your sample about resize but i use it in a streaming jpg mode and i wonder if we can optimized the code to speed up. The process with "for" in "for" lose time with an image (320x240) Best regards,
LuisMiguel Rubio
Greenhorn
Joined: Jul 27, 2005
Posts: 1
posted
Hello. Thanks for your code. I've created other faster than yours, but i think it could be faster with some changes. And the more important, can resize images with transparent pixels.
It works with RGBArrays. First, we need a function to resize Arrays:
INI: Source Array X: Width of Source Array Y: Height of Source Array X2: Width of the Output Array Y2: Height of the Output Array Returns OUT (Output Array)
How to use it:
Et voil�. Next, i will modify a bit the "reescalaArray" function to improve more speed. If you get better results, please, share the solution
Happy summer!!
PD: Sorry my English, but i am Spanish [ July 27, 2005: Message edited by: LuisMiguel Rubio ]