how to display bigger resolution images in android? - android

referring to the code example of mine
android Remote image Getting problem?
how can i accommodate bigger resolution images in android.
when i try to display bigger resolution image from internet it give me null bitmap.
any one guide me whats the solution?
any help would be appreciated.

i would like to suggest a rather simple way to display high resolution images i.e. if u just want to display them n not store them.
there are some nice answers here. Hope it helps to achieve wat u expect...

Related

Can we use SVG/Vector image for flood fill algorithm? If yes then how?

I implemented QueueLinearFloodFill Algorithm it works fast for me, but the images I am using are .PNG type, all good quality images are also returning in the issue that white part is left uncolored at border. So Can I use SVG/Vector type. and if yes how.
Thanks in advance

Clean image before OCR?

Before
After
I found a spectacular example demonstrate how to clear image before OCR, I think much about it and try to analyze it, It was awesome.
Compare with original image , the processed image has :
Remove background and unrelated objects
Remove flash radiance
Enhance text
Scale image to fit the content.
Does anybody know how do this ? I mean which steps ? (grey, scale, threshold,...)
Thank for your reading
Looks like simple segmentation using the color of the text.

Cocos2D android background image gets messed up

so im trying to make a game with just a simple static background at the moment, but when i draw it to the screen (no scaling being done as the resolution of the image is the same as the screen) it draws the bottom portion of the image incorrectly where the bottom few hundred pixels of the image are exactly the same going down the image. Sorry it's so difficult to explain but being new here i cant actually post an image of what is going wrong.
Now im just using a simple sprite to render this background image. Here is the code being used:
// background layer: another image
background = CCSprite.sprite("WaterBackground.png");
// change the transform anchor point (optional)
background.setPosition(CGPoint.make(GAME_WIDTH/2, GAME_HEIGHT/2));
addChild(background);
am i doing something wrong here? Does Cocos2D not support such large images for sprites? (resolution of 800*1280)
Any help would be greatly appreciated!
Since i am now able to upload images, here are visuals of what is going wrong:
And the problem in my game:
As you can see, the problem is hard to describe. The problem only exists with this larger image; i scaled it down manually in GIMP and then scaled it up for the game and it looked fine (except for being a lower resolution). I also tried scaling down this larger image which still resulted in the same problem. Hopefully you guys can help me as I have no clue what could possibly cause this error. Especially since i read that Cocos2D's max supported image size is 2048*2048 and my image is well within that.
Thanks for any help you guys can provide!
This is due to limitations on the size of textures. Coсos2d-android supports images with a maximum size of 1024 x 1024 pixels.
I faced the same problem and looking for a way to solve it.
EDIT
I found the solution
In cocos2d project open file CCTexture2d.java in org.cocos2d.opengl package and change kMaxTextureSize from 1024 to 2048
I'm not certain, as from your code and looking at the cocos2d code I can't see a definite reason why this would be happening, but given the number of sprites you've got on the screen, i'd definitely take a look at my answer to this question as you may well be hitting one of cocos2d's quirky little rendering faults around multiple sprites. can't hurt to try spritesheets, and it's certainly the correct way to actually do sprites in cocos.
also, definitely create yourself a helper utility to determine the scaling ratio of a device compared to your original image sizes, as unlike on iphone, android does have a pretty much unlimited variation of screen resolutions, and a simple bit of "scale as you load" utility code now will save you lots of time in the future if you want to use this on any other device.
you should try to make one method for adding background,i am doing this this like this way try this hope it will help full for you...here addBackGroundScene is my method and i am adding my background with this method,scrXScaleFactor is maintaining scaling part of my screen try this...
private void addBackGroundScene() {
CCSprite bgForLevel1 = addBackgroundAtOrigin("prelevel1/bgMenu.jpg");
bgForLevel1 .setScaleX(scrXScaleFactor);
bgForLevel1 .setAnchorPoint(0, 0);
addChild(bgForLevel1 );
}

android: how to load and display large images(A0 size) - like google map did?

I have to load and display some very large images, some have size A0(33.1 × 46.8 inches) .I did follow the way Google map display map by split the image in to may tile( size 128x128 pixel) in difference zoom levels ( for zooming in/out) and load them on the view , but i still get stuck on the performance issues , it doesn't smooth enough . I think some as you have faced the same issue and got the idea to solved, so if you can please shared with me and everybody . As i know there is a CATiledLayer Class for doing this work on iOS system . Any help will be appreciated.
Check this. According to its README it's a "A tiling scrollview to display large picture (similar to iOS "CATiledLayer")"
there is one third party library called MapView,
this is best to load very large images.
try this link

Do I have to have one wallpaper file for each screen resolution?

There is an app that sets 960x800 image as phone's wallpaper. I found that many developers suggest this resolution. However, an image is still getting cropped. I use a basic code for setting the wallpaper
WallpaperManager wallpaperManager = WallpaperManager.getInstance(getApplicationContext());
wallpaperManager.setResource(R.drawable.some_image);
I need an advice on what to do next:
Make one wallpaper for each screen resolution?
Programmatically resize image to a current screen resolution?
I am using the wrong code and there is a better one
If the second choice is the right solution, how should I do it? I'd appreciate some links if there's too much coding involved.
Thanks
Use a 9-patch image for backgrounds, wallpapers are the same I think. Google docs on Android recommend this. This image is stretchable. A good link explaining it is here.

Categories

Resources