Thanks for your suggestions. Here are some of mine concerns for just using script resolution.
Firstly, The file can be seen as an overrider for img.Get.java file of out-of-box foundation parbase component. So I put it in content as CQ put the servlet under the parbase component.
Besides, Component-based develop is one of the CQ characters, the host component in repository may be a  better place for his servlet/script renderers to keep. Compared to creating a new servlet to intercept the request, it is more convenient for develop can easily copy the file to his own component with slightly modification and the open source can be easily referred to.