scraper
scraper copied to clipboard
"mix3" image size coherence
Hi !
I'm using the scraper using the "mix3" image, from ScreenScraper source. I'm assuming the image is generated by the scraper and it's not the pre-configured "mix" from SS that's grabbed, but maybe I'm wrong.
It works great, except that it seems that it does not resize the screenshot. So, some systems have a very small screenshot area, and others are much larger. It even varies from game to game, since some screenshots are at the original resolution, and others are stretched.
Is there a way to have always the same screenshot size ? Even if it means the screenshot is stretched ?
I'm willing to spend some time working on it (despite not knowing go, it would be a way to learn it) if you point me in the direction :)
Thanks !
Hi,
You are correct that the scraper generates the mix image. At the time there wasn't a precomputed mix available from the source so if that is available, we could switch.
The existing code is in the file https://github.com/sselph/scraper/blob/master/mix_experiment/mix.go
I threw it together one night. It has some functions that define how to overlay the images. This is the one for the mix3. It defines the overall image size and the size and position of all the elements in relation to the overall image. https://github.com/sselph/scraper/blob/master/mix_experiment/mix.go#L78
Then the Draw function here loops through all the elements to draw them on an empty image. https://github.com/sselph/scraper/blob/master/mix_experiment/mix.go#L145
I think you might be seeing an issue because of the resize.Thumbnail here. This resizes the image but maintains the width:height ratio. This was done for systems with screens that are taller than they are wide. It also has the side effect of not increasing the image size so if someone made a really small screenshot it wouldn't resize it to fill the space. https://github.com/sselph/scraper/blob/master/mix_experiment/mix.go#L159
So could do something similar to this to preserve the ratio but allow the code to also scale up images if needed. https://github.com/nfnt/resize/blob/master/thumbnail.go#L38