Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coil.get() throws IllegalArgumentException when converting SVG toBitmap #92

Closed
0xMatthewGroves opened this issue Sep 8, 2019 · 1 comment · Fixed by #124
Closed
Labels
bug Something isn't working help wanted Issues that are up for grabs + are good candidates for community PRs

Comments

@0xMatthewGroves
Copy link

0xMatthewGroves commented Sep 8, 2019

Latest version 0.7.0 crash when attempting to get SVG asset via Coil.get() and using Drawable .toBitmap() to convert it to a bitmap.

Usage:

    Coil.get(iconUrl)
        .toBitmap()

Stacktrace:

java.lang.IllegalArgumentException: width and height must be > 0
    at android.graphics.Bitmap.createBitmap(Bitmap.java:829)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:808)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:775)
    at androidx.core.graphics.drawable.DrawableKt.toBitmap(Drawable.kt:60)
    at androidx.core.graphics.drawable.DrawableKt.toBitmap$default(Drawable.kt:45)
...
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:740)
@colinrtwhite
Copy link
Member

Thanks for the report. Do you have a public SVG that can be used to reproduce the crash? My guess is that the SVG is missing the viewbox element.

I'm only holiday this week, but will be able to take a look next week.

@colinrtwhite colinrtwhite added the help wanted Issues that are up for grabs + are good candidates for community PRs label Sep 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Issues that are up for grabs + are good candidates for community PRs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants