Can i specify an image style in my custom module
There are several options:


Use a view
Use Twig Tweak with a display mode, where you configure the image style
Use this code How to find image style URL from within twig template?


If you don't need more than what is in your question, I would start with 1, because don't reinvent code for things that are in core.