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

Some images become black after a few miliseconds #110

Closed
Aerion opened this issue Nov 2, 2024 · 4 comments
Closed

Some images become black after a few miliseconds #110

Aerion opened this issue Nov 2, 2024 · 4 comments

Comments

@Aerion
Copy link

Aerion commented Nov 2, 2024

Hello,

Some images are not displayed correctly: they appear, and after a few ms, in their place there is a black rectangle.
Here is one example: https://images.timeguessr.com/c6c25f48-850b-4fdf-b961-cb98b434342a.jpg

I intially thought the issue was coming from coil, but it displays properly with AsyncImage.

I'm using zoomable-image-coil v0.13.0 and coil v2.6.0.

For reproduction

val url = "https://images.timeguessr.com/c6c25f48-850b-4fdf-b961-cb98b434342a.jpg"
    Column(modifier = Modifier.fillMaxSize()) {
        AsyncImage(
            model = url,
            contentDescription = null,
            modifier = Modifier.fillMaxSize(0.5f),
        )
        ZoomableAsyncImage(
            model = url,
            contentDescription = null,
            modifier = Modifier.fillMaxSize(0.5f),
        )
    }
repro-telephoto.mov

Would you know what could be the cause of this issue?

Best,

@saket
Copy link
Owner

saket commented Nov 2, 2024

It seems like the image's color space is losing some information when it's converted between Android <> Compose UI formats. I'll investigate this further when time permits, but in the meantime can you try working around this by forcing a color space?

ZoomableAsyncImage(
  model = ImageRequest.Builder(LocalContext.current)
    .data("https://images.timeguessr.com/c6c25f48-850b-4fdf-b961-cb98b434342a.jpg")
    .colorSpace(ColorSpace.get(ColorSpace.Named.SRGB))
    .build(),
  …
)

@Aerion
Copy link
Author

Aerion commented Nov 2, 2024

in the meantime can you try working around this by forcing a color space?

It seems to do the trick indeed, thanks for the prompt response!

Aerion added a commit to Aerion/timeguessr-android that referenced this issue Nov 2, 2024
As per [0], hardcode the SRGB colorspace for now to prevent
having black pictures on some images.

[0] saket/telephoto#110
@saket
Copy link
Owner

saket commented Nov 3, 2024

I think this is an issue in Compose UI. I filed an issue here: https://issuetracker.google.com/issues/377021410.

saket added a commit that referenced this issue Nov 3, 2024
@saket saket closed this as completed in af0cce0 Nov 3, 2024
@saket
Copy link
Owner

saket commented Nov 13, 2024

0.14.0 is released with a workaround for this: https://github.com/saket/telephoto/releases/tag/0.14.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants