Load and edit width and height on CCImage before adding in the texture - Android

Hi!
My android (Samsung Nexus S) have pictures with sizes bigger than the texture supported, 2048. I have a image explorer on my application and i need load my android pictures, so i need resize these pictures for add on texture and create a sprite. How I set width and height on CCImage before add on texture?

This method return false because my CCImage is too bigger (2560x1920):

// implementation CCTexture2D (Image
bool CCTexture2D::initWithImage(CCImage *uiImage)
{
    if (uiImage == NULL)
    {
        CCLOG("cocos2d: CCTexture2D. Can't create Texture. UIImage is nil");
        return false;
    }
    
    unsigned int imageWidth = uiImage->getWidth();
    unsigned int imageHeight = uiImage->getHeight();
    
    CCConfiguration *conf = CCConfiguration::sharedConfiguration();
    
    unsigned maxTextureSize = conf->getMaxTextureSize();
    if (imageWidth > maxTextureSize || imageHeight > maxTextureSize) 
    {
        CCLOG("cocos2d: WARNING: Image (%u x %u) is bigger than the supported %u x %u", imageWidth, imageHeight, maxTextureSize, maxTextureSize);
        return false;
    }
    
    // always load premultiplied images
    return initPremultipliedATextureWithImage(uiImage, imageWidth, imageHeight);
}

Thanks very much!

MG

You should resize and save as a new image in Android after it is selected. Then use the new image in cocos2dx

Ok, but before select image i need show the android pictures. And when i load and show the pictures i have this information: cocos2d: WARNING: Image (2560 x 1920) is bigger than the supported 2048 x 2048. I need show the pictures starting with picture path…and picture is too big. How i can resize the pictures (CCImage)?

maybe you can resize the image using android api first
http://stackoverflow.com/questions/10413659/how-to-resize-image-in-android