[android] load image from gallery is very slow

I need to import the photos from the gallery into Texture2D format.

  1. Pass the value of Configuration::getInstance ()->getMaxTextureSize () to the .java file (using JNIHelper).
  2. Load the image from the .java file and adjust it smaller if the image size is larger than maxTextureSize.
  3. Convert the resized image to png format and pass the byte data to c++.
  4. Create image by passing byte data to Image::initWithImageData() and Texture2D with Texture2D::initWithImage().

This method works very well, but the problem is that it is very slow.
Is there any way to speed it up?

Which part is slow? Have you profiled the process to see how long each step is taking?

No I haven’t profiled how long each step takes.
However, compared to Android native apps, there are many times the difference.
Is the method I am currently using the best one?
Thank you!