Comments (21)
When attaching retina monitor Chromy uses the Jimp library to resize an image.
This behavior produces a different image with between retina and non-retina.
I've added .setDeviceScaleFactor() in v0.5.1 @beta .
This command force Chrome to display in same pixel ratio always.
Currently I have not enough time to test it with BackstopJS.
So I'm not sure this approach works well. But worth to try.
If works, in backstop case, this command would also resolve screenshot performance issue caused by Jimp.
from chromy.
How do I use .setDeviceScaleFactor()
?
Like this?
chromy.chain()
.setDeviceScaleFactor()
.goto()
...
Do I need an argument inside .setDeviceScaleFactor()
from chromy.
.setDeviceScaleFactor(1)
from chromy.
And with this set to 1, Jimp will not try to rescale?
from chromy.
Yes. Jimp is not called after .setDeviceScaleFactor(1)
is called.
Resizing is achieved by Chrome's emulation feature.
from chromy.
Ok. Will try this and let you know how it goes. Thanks!
from chromy.
So, mixed results...
- .screenshotMultipleSelectors() is still failing
😿 - .screenshot() is now working
😺
Hopefully you can apply the same fix to screenshotMultipleSelectors() ?
See images below...
from chromy.
Here is another part of the test.
The actual file dimensions is off. Rounding error or perhaps a bug?
In Backstop, every pixel value is compared, 1:1 file is required. It can not be resampled.
The borders in the image are 1px
from chromy.
Hi @dotneet, I wanted to check and see if you have any thoughts about this one?
from chromy.
Sorry, I've overlooked your comments.
I've improved the process for scaling in v0.5.2@alpha.
Could you test it whether the change fix this problem?
from chromy.
nice! Checking right now...
from chromy.
@dotneet sadly no -- did not change anything
Did you observe the above results? Is the processing between the above capture methods different?
from chromy.
@garris .screenshotMultipleSelectors() uses full screen emulation but .screenshot() does not.
I've arranged test environments and confirmed that the problem is reproduced.
Please wait for next report. But now I'm working on my job so I can't do this soon.
from chromy.
Ok. I understand. Best wishes with your work.
I'll wait for your next report. Thank you.
from chromy.
@garris I've investigated this problem for several hours, but I can't find out a solution.
I think this results is caused by difference of processes that generate an image.
If my thoughts is correct, resolving this problem is very difficult.
With high resolution screen, to generate same resolution results Chrome need to scale down an image by scaling algorithm. On the other side, with low resolution screen, Chrome don't need to scale an image. What Chrome should do is only capturing the image that is displayed on itself.
So, by the difference of processes, these results become different images regardless of same size.
from chromy.
Possibly I found out the solution!
Please wait some times.
from chromy.
@garris please try to add '--force-device-scale-factor=1' to chromeFlags. In my environments, this flag resolved the problem.
from chromy.
Yes -- this is GREAT! You have discovered the solution to the size ratio problem!
from chromy.
...But interestingly... I am so sorry to report a new issue has appeared!
My guess is that monitor color profile is now causing an issue. In this example there is a large green area on the screen. When referenced on my 72ppi monitor and tested with my retina laptop I get the following diff where all areas of color are slightly different...
It seems that chrome-headless delegates to hardware for rendering pretty significantly. Have you seen anything about how "software-only" rendering could be used with chrome?
In the meantime, perhaps changing monitor profiles will help?
from chromy.
Thank you for fixing this! I will create a new ticket for the new issue ^^^
from chromy.
fixes garris/BackstopJS#504
from chromy.
Related Issues (20)
- ECONNREFUSED on chromy start HOT 2
- How to Add Cookie before go to url HOT 3
- Open Chrome with user logged in. HOT 2
- userDataDir causes bug with multiple scenarios.
- querySelectorAll returning an empty object
- Tests falsifiability
- Host header is specified and is not an IP address or localhost. HOT 5
- Sending X and Y to mouse pressed
- Ability to Inject Online Scripts
- TypeError: Cannot read property 'length' of null using position absolute
- Double click API HOT 1
- Hide elements in dom. HOT 3
- Goto not working if it's the same as current url?
- Viewport (vh) units incorrect in screenshots HOT 1
- How can i use this on Heroku platform?
- Orientation of emulated mobile device HOT 1
- Detect when Chrome is closed by user.
- Simutaneous screenshots doesn't work beyond 2 instances of chromy
- Internal Linking not working in the website!!
- Chrome instance viewport size HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chromy.