How to get the pixels of a texture which is in memory

I make some texture into AssetBundle, and loaded it in memory.
I want to patch all texture in assetBundle into one atlas.
But can’t get the pixels of each texture.

code like this:

assetBundleTexture.GetPixels32();

got error:

Texture 001 is not readable, the texture memory can not be accessed from scripts.
You can make the texture readable in the Texture Import Settings.

whether the Unity locked the memory block where the assetBundle used or not.
and what should i do.

Thanks in advance!

There is another way to bypass the read/write restriction;

basically its the operation you perform when rescaling a texture (but in this case you don’t actually rescale - see http://gamedev.stackexchange.com/questions/92285/unity3d-resize-texture-without-corruption)

Perhaps the following code can be optimized, but it works:

Color32[] pixelBlock = null;
            try
                {
                pixelBlock = img.GetPixels32();
                }
            catch (UnityException _e)
                {
                img.filterMode = FilterMode.Point;
                RenderTexture rt = RenderTexture.GetTemporary(img.width, img.height);
                rt.filterMode = FilterMode.Point;
                RenderTexture.active = rt;
                Graphics.Blit(img, rt);
                Texture2D img2 = new Texture2D(img.width, img.height);
                img2.ReadPixels(new Rect(0, 0, img.width, img.height), 0, 0);
                img2.Apply();
                RenderTexture.active = null;
                img = img2;
                pixelBlock = img.GetPixels32();
                }

you need to set the texture as readable before GetPixels or SetPixels;
see the unity script reference ( i use one simple google search )

Thanks very much erick_weil.
Finally, i achieve it via file operation.
Here is another answer: