Giter Site home page Giter Site logo

Comments (21)

dotneet avatar dotneet commented on May 12, 2024

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.

garris avatar garris commented on May 12, 2024

How do I use .setDeviceScaleFactor()?

Like this?

chromy.chain()
  .setDeviceScaleFactor()
  .goto()
  ...

Do I need an argument inside .setDeviceScaleFactor()

from chromy.

dotneet avatar dotneet commented on May 12, 2024
.setDeviceScaleFactor(1)

from chromy.

garris avatar garris commented on May 12, 2024

And with this set to 1, Jimp will not try to rescale?

from chromy.

dotneet avatar dotneet commented on May 12, 2024

Yes. Jimp is not called after .setDeviceScaleFactor(1) is called.
Resizing is achieved by Chrome's emulation feature.

from chromy.

garris avatar garris commented on May 12, 2024

Ok. Will try this and let you know how it goes. Thanks!

from chromy.

garris avatar garris commented on May 12, 2024

So, mixed results...

  • .screenshotMultipleSelectors() is still failing 😿
  • .screenshot() is now working 😺

Hopefully you can apply the same fix to screenshotMultipleSelectors() ?

See images below...

screenshotMultipleSelectors()
image


screenshot()
image

from chromy.

garris avatar garris commented on May 12, 2024

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
image

from chromy.

garris avatar garris commented on May 12, 2024

Hi @dotneet, I wanted to check and see if you have any thoughts about this one?

from chromy.

dotneet avatar dotneet commented on May 12, 2024

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.

garris avatar garris commented on May 12, 2024

nice! Checking right now...

from chromy.

garris avatar garris commented on May 12, 2024

@dotneet sadly no -- did not change anything 😢.

Did you observe the above results? Is the processing between the above capture methods different?

from chromy.

dotneet avatar dotneet commented on May 12, 2024

@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.

garris avatar garris commented on May 12, 2024

Ok. I understand. Best wishes with your work.

I'll wait for your next report. Thank you.

from chromy.

dotneet avatar dotneet commented on May 12, 2024

@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.

dotneet avatar dotneet commented on May 12, 2024

Possibly I found out the solution!
Please wait some times.

from chromy.

dotneet avatar dotneet commented on May 12, 2024

@garris please try to add '--force-device-scale-factor=1' to chromeFlags. In my environments, this flag resolved the problem.

from chromy.

garris avatar garris commented on May 12, 2024

Yes -- this is GREAT! You have discovered the solution to the size ratio problem! 😺

from chromy.

garris avatar garris commented on May 12, 2024

...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...

image

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.

garris avatar garris commented on May 12, 2024

Thank you for fixing this! I will create a new ticket for the new issue ^^^

from chromy.

garris avatar garris commented on May 12, 2024

fixes garris/BackstopJS#504

from chromy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.