paparazzi icon indicating copy to clipboard operation
paparazzi copied to clipboard

Screenshots generated with device config with huge height are low in resolution

Open iamutkarshtiwari opened this issue 3 years ago • 3 comments

Description Same as the title. There are previews in my project that are scrollable so to avoid the final image being clipped, I set my device config as follow:

@get:Rule
val paparazzi = Paparazzi(
    maxPercentDifference = 0.0,
    deviceConfig = PIXEL_5.copy(
        softButtons = false,
        // This custom height is to allow enough viewport height to prevent clipping
        // of scrollable previews in example screens
        screenHeight = 7020,     // This is 3 times the height of the original config.
        density = Density.XXXHIGH   // This is the maximum we can go
    ),
    renderingMode = SessionParams.RenderingMode.SHRINK
)

Thanks to the improved RenderingMode.SHRINK the final image takes the exact size required to created an unclipped screenshot. However, the image resolution now falls down to to be low so when I zoom into the image, it gets pixelated and loose image.

Is there any way this could be solved?

Expected behavior The generated image should have high resolution to be able to accurately pixel match while screenshot testing with paparazzi.

Additional information:

  • Paparazzi Version: 1.2.0
  • OS: Android
  • Compile SDK: 32
  • Gradle Version: 7.5
  • Android Gradle Plugin Version: 7.2.1

Screenshots If applicable, add screenshots to help explain your problem.

iamutkarshtiwari avatar Jan 24 '23 08:01 iamutkarshtiwari

I believe this is because Paparazzi restricts the max width / height of an image to 1000px, and scales down a snapshot to match that

It should be pretty easy to add configuration for this I think - is this something that the authors are open to? If yes then I'll raise a PR for it

Ezard avatar Oct 15 '23 03:10 Ezard

Sounds like a duplicate of https://github.com/cashapp/paparazzi/issues/482 with PR up https://github.com/cashapp/paparazzi/pull/543 (would this PR match your expectation, @Ezard?)

TWiStErRob avatar Oct 15 '23 09:10 TWiStErRob

@TWiStErRob I agree that that's a duplicate, and yep that PR is is almost exactly what I would've written 👍

Ezard avatar Oct 15 '23 13:10 Ezard