cashapp / paparazzi

Render your Android screens without a physical device or emulator
https://cashapp.github.io/paparazzi/
Apache License 2.0
2.25k stars 213 forks source link

Support webp images #258

Open RainNapper opened 2 years ago

RainNapper commented 2 years ago

Webp drawable resources are showing up in screenshots broken images (see attached image).

After converting them to .png, they show up as expected, which leads me to believe it's an issue with .webp support.

Screen Shot 2021-09-09 at 1 58 29 PM

consp1racy commented 2 years ago

Does it work when you add

testImplementation("org.sejda.imageio:webp-imageio:0.1.6")

along with Paparazzi?

a-smirnov-at-veriff commented 2 years ago

@consp1racy I'm facing the same issue. If I add the library you've mentioned above, test fails:

java.lang.NoClassDefFoundError: Could not initialize class com.luciad.imageio.webp.WebPDecoderOptions
    at com.luciad.imageio.webp.WebPReadParam.<init>(WebPReadParam.java:24)
    at com.luciad.imageio.webp.WebPReader.getDefaultReadParam(WebPReader.java:147)
    at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1464)
    at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1363)
    at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:124)
    at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:108)
    at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:387)
    at android.content.res.Resources_Delegate.getDrawable(Resources_Delegate.java:186)
    at android.content.res.Resources.getDrawable(Resources.java:845)
    at androidx.core.content.res.ResourcesCompat.getDrawable(ResourcesCompat.java:104)

UPD. In my case WebP native library was the cause of the problem, as it's built only for x86_64 on macOS. I've rebuilt it for Apple Silicon and it works fine. On the other platforms it works fine out-of-the-box.