I asked this question a few days ago in MathExchange and received no satisfatory answer. I hope it is well suited for MathOverflow.
Suppose I have two linear operators $X,\,Y$ on $\mathbb{C}^n$. Now let $a,b\in\mathbb{C}$ and consider $Z_{a,b}:=aX+bY$. When we look at their images we clearly have $$im\,Z_{a,b}\subseteq \,im\,X+im\,Y,$$ but in general this inclusion is strict. At the beginning I asked myself if it would be true that the equality holds whenever we take $a,b\in\mathbb{C}$ sufficiently general. Someone then pointed out that this is false: just take
$$ X = \pmatrix{1&0\\0&0}, \quad Y = \pmatrix{0&0\\1&0}. $$
Then I moved to the case where we know that $X,Y$ commute. In this case it is known that $X,\,Y$ are simultaneously upper triangularizable. Even with this simplification I could not find a proof or counter-example. I think this would follow from some sort of rank semicontinuity in Zariski topology but not sure how to prove this.
Stating questions explicitly:
1 - If $XY=YX$, is it true that $im\,Z_{a,b}=\,im\,X+im\,Y$ for $(a:b)$ a general point of $\mathbb{P}^1$?
An obvious generalization of the first question:
2 - Given a family of $X_0,\ldots,X_{m}$ of commuting operators in $\mathbb{C}^n$ is it true that $Z_{a_0,\ldots,a_{m}}:=\sum_i\,a_i X_i$ satisfies $im(Z_{a_0,\ldots,a_{m}})=\sum_i\,im(X_i)$ for a general $(a_0:\ldots:a_m)\in\mathbb{P}^m$?