reiinakano / arbitrary-image-stylization-tfjs

Arbitrary style transfer using TensorFlow.js
https://reiinakano.github.io/arbitrary-image-stylization-tfjs/
Apache License 2.0
1.19k stars 214 forks source link

incorrect stylized image when the screen resolution isn't 1920x1080 #20

Open zssloth opened 5 years ago

zssloth commented 5 years ago

Hi, I tested the style transfer result in the demo website and found that I could not get correct stylized image when the screen resolution isn't 1920x1080. For example, when the screen resolution is 2160x1440, the generated image looks like this: screen while it works for another computer with 1920x1080 resolution. Are there any possible reasons about this issue?

skanel commented 4 years ago

but that is also a style. it is artist

geni94 commented 3 years ago

There are multiple ways to do this. The easiest and most straightforward one, would be to set a height and width to the final canvas or image element (depending on what you're using). For instance, doing canvas.height = 1920 after you've drawn the image to it, should work as expected. In the case of a <img />, setting one of the attributes statically (say, <img height="1920" {...} /> will set the desired height and adjust the width proportionally. Alternatively, you can set both of them statically.

The model will render the resolution of the container image, i.e. the first image selected by the User, and not the one used for "styling", so unless you've forced some custom width/height beforehand, it should render the resolution appropriately.