04-28-2010 04:41 PM
I'd do what aclark said. It says right in the API documentation that the LANCZOS filter "may also introduce some ringing artifacts" which is what I think you are experencing on the star.
As for the heart, that's another story, you could try a different filter, changing the bit-depth, etc. Try to isolate it, create a seperete project and do it in that so you can focus on it and it only. If you can't reproduce it then it is something in your app, otherwise it is something with the image and you can try different things to fix it.
04-28-2010 04:45 PM
Yes, it is beyond me too. I am familiar with the transparent pixels concept, but I didn't even know about adding an alpha channel to a bitmap to get transparent pixels.
I did try other filters because the star seems to be a problem with the filter (the heart doesn't though), but it didn't help. I know it can work on BlackBerry's because I set the bitmaps as the screen background and they scaled properly and the transparent pixels worked. But using transparent pixels for the screen background does not achieve the desired effect as the user can see the screen below.
Thanks again for all the assistance though. I do not know how I could do this without help from people like you. I too try to contribute back to the forum that has helped me so much.
04-29-2010 04:03 PM
05-05-2010 05:08 PM
I'm also experiencing artifacting when scaling transperant images.
Interesting. This occurs using all three filters though.
If transperancy is not set, the artifacts go away but obvious, alpha channel is also gone.
06-09-2010 05:52 AM
Hi All
Even I am trying to get the Transparency pixel when resized. Can you please help me in this context.
My Code is
_offPicture = new Bitmap( _prefferredWidth,
_prefferredHeight);
Bitmap resizeBitmapOff = Bitmap.getBitmapResource(offImage);
resizeBitmapOff.scaleInto(_offPicture,
Bitmap.FILTER_BILINEAR,
Bitmap.SCALE_STRETCH);
After the above code, I am using "_offPicture" inside BitmapField.
Can you tell me what and How I need to set Alpha, so that I can see transparent Image
offPicture
06-09-2010 06:14 AM
Hi All
After trying few more times, I got the solution and the code is as follows
public static Bitmap resizedImage(String imageName, int width, int height) {
Bitmap actualBitmap = Bitmap.getBitmapResource(imageName);
Bitmap resizedBitmap = new Bitmap(width, height);
resizedBitmap.createAlpha(Bitmap.ALPHA_BITDEPTH_8B PP);
int[] stripe=new int[width]; for (int n=width-1;n>=0;n--) stripe[n]=0;
for (int y=height-1;y>=0;y--) resizedBitmap.setARGB(stripe,0,width,0,y,width,1);
actualBitmap.scaleInto(resizedBitmap, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_STRETCH);
return resizedBitmap;
}
I have a question:
I think there is little bit performance issues by doing a for loop. Is there any other solution for the above
06-10-2010 06:03 PM
Since you should only do the resizing once and than cache, performance of one loop is not going to be noticeable.
You should be good to go.
10-16-2010 03:54 PM
For those interested, I just posted some code to fix the edging and other artifacts problems created by scaleInto(). Post: http://supportforums.blackberry.com/t5/Java-Develo