I got blackout material from Jo'Anns and using stapled Velcro, inside the window frame, and with some trial and error, got a very good fit.
I did allow another one and a half inches of extra material as an all-around border, to the Velcro, as a baffle and that helped a lot!
To make sure that no direct light, should time of misadventure loosen the light seal and i no catch it soon enough, I used an inexpensive white blinds, as another 'baffle' layer.
It's been at least 5 years and no leaks so far.
Tip; Use a stable table of sheet plywood or heavy exterior foam isolation to lay out the material, for marking and cutting, and if you machine sew, remember the 'rubber' side of the material, once pierced by even a small needle, will allow hundreds of stitches to become pinhole lights, when blocking out sun and sky!
I used good quality, fabric backed Gaffer's tape to seal sewn seams, and that did the trick, but using a good fabric glue to apply strips of blackout fabric to those seams, will work as well, just be certain to glue fabric to fabric, no the rubber sides.
Cheers.