In theory there is no limit if the number of collected photons can be arbitrarily large and the object is stationary. The diffraction limit and lens imperfections can be circumvented by deconvolution. The limitations due to the finite pixel size can be dealt with using superresolution methods. Here you make multiple exposures where the camera is shifted such that the picture shifts by a some fraction of the pixel length. These can then be combined into a picture that has more pixels than the camera sensor has.
For the problem of resolving stellar objects, Leon Lucy has shown here that the resolution that can be obtained using N photons in the limit that N goes to infinity behaves as N^(-1/8). Based on numerical experiments using the Richardson-Lucy deconvolution method, he obtains an estimate for the number of photons needed to obtain a resolution of x times the diffraction limited resolution of N = 1.4 * 10^6 (0.2/x)^8. The fact that the number of photons needed increases as the 8th power, means that increasing the resolution by a large factor is not possible in practice. Astronomers do need to invest in larger telescopes to be able to see more details.
It should be noted that these methods work best for resolving point like objects, or objects for which the small scale structure is known. So, in the case of a tree, to get the most out of deconvolution, you should have a model of how leaves, branches etc, look like. If the picture shows a barely visibly tree with the branches difficult to see and the leaves merged together in one big green blur, you can in theory still make the tree with the leaves visible. But this requires specifying a model of the possible shapes the leaves can have.