-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Can't get the Bitmap when Capturable includes Network image #7
Comments
@jeluchu can you provide full stacktrace? It doesn't look like issue of this library |
Yes @PatilShreyas, here I show you the log and also the function I do to send the bitmap, there is a bug in val uri = Uri.parse(path) because as such the bitmap generated by Capturable gives me full (as far as I have seen debugging). When the bitmap is generated what I do is a function to share that generated image
|
The log which you shared here is about For saving bitmap, you can refer to this code fun saveBitmap(context: Context, bitmap: Bitmap, filename: String = DEFAULT_FILENAME): Uri? {
val contentValues = ContentValues().apply {
put(MediaStore.MediaColumns.DISPLAY_NAME, filename)
put(MediaStore.MediaColumns.MIME_TYPE, "image/jpeg")
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
put(MediaStore.MediaColumns.RELATIVE_PATH, Environment.DIRECTORY_PICTURES)
}
}
val contentResolver = context.contentResolver
val imageUri: Uri? = contentResolver.insert(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
contentValues
)
return imageUri.also {
val fileOutputStream = imageUri?.let { contentResolver.openOutputStream(it) }
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream)
fileOutputStream?.close()
}
} Closing this issue since this doesn't looks like associated with the library. |
But the problem is not that @PatilShreyas, since I am using that function that I was showing you in another area and it works without problems, when capturing the bitmap, it always comes as null, so I can't save the bitmap in any case There you can see the real problem, the bitmap is null and error shows a different message |
Oh okay @jeluchu, if that's the issue then reopening this issue. Can you give me details like on which device you're testing and all? |
I am currently testing on a simulator, Pixel 4 XL with API Level 31, I also tested with a physical device of the brand BQ X Pro with API Level 30, but I had the same result. If you need any other details, please let me know @PatilShreyas |
Can you send me the project sample on which this issue is occurring? Maybe a zip of the project? (If works for you) |
I would have to try to make a project from scratch, since I implemented the library in one of the apps I have made in compose and published in the Play Store. Maybe in a zero development it will work, but in the current development I have it is not working correctly as I have indicated before |
@PatilShreyas I have discovered something about this error that I pointed out to you My composable LetterImage contains another composable I have which is NetworkImage
NetworkImage is a component I have for uploading images together with the Coil library, with which you can pass a url to upload an image from the internet. I've been making several modifications inside the composable I want to capture (LetterImage) and I always get the same error:
So I tried to remove the composable NetworkImage that remotely loads the background image, and it works. From what I've seen, the incompatibility is with the images that are uploaded over the internet and it's not able to capture them with the full Composable. I don't know if your library is really compatible, or if there is already a way to make this work with images uploaded over the internet. I hope I've explained correctly what I've discovered, and that you can shed some more light on this problem. Thank you very much! |
Thanks @jeluchu for the detailed info, will look into it. |
As mentioned here: #9 (comment)
Thanks, @jeluchu for this helpful finding and for making it better 😀. This will be released in |
Fix #7: IllegalArgumentException: Software rendering doesn't support hardware bitmaps
Thank you very much @PatilShreyas ! |
@jeluchu This has been released in |
I have just tested it and it works fine, thank you very much again @PatilShreyas! 🎊 |
Hi @PatilShreyas, I am using your v1.0.3 library and still encounter with this error. The bitmap returned in callback is always null. I have run my code in emulator device on Android O (API 26). Any suggestions for me to solve this matter? |
This is my brief of composition structure. The imageUri is the uri of an image from image gallery
|
Here is the full log of the exception. Hope to see your response as soon as possible @PatilShreyas
|
PixelCopy made another issue: #101 |
Hello!! When I press the button where I have the controller.capture function, I get the same error all the time, at first I thought I had something wrong configured, I cloned the repository to see the example, and I had it similar, but the example does not give me the same error as me
java.lang.IllegalArgumentException: Software rendering doesn't support hardware bitmaps
The text was updated successfully, but these errors were encountered: