Lamelynx / GodotGetImagePlugin-Android

Godot plugin to select image from gallery or camera on Android device.
MIT License
71 stars 4 forks source link

Png file transparency turns to black #2

Closed ssalvate closed 3 years ago

ssalvate commented 3 years ago

Hey Lamelynx, I got your plugin incorporated into my game. I saw your post back here https://godotengine.org/qa/78664/black-texture-when-loading-images-in-runtime-on-android. I am able to load a texture, but all the transparency values are turning to black. I tried to switch load_jpg_from_buffer to load_png_from_buffer but that gives me an error that the file is not a png. Have you figured out how to load an image and keep its transparency? JPG doesn't support transparency.

Lamelynx commented 3 years ago

Hi I have added additional option "image_format". Set this to "png" and then use load_png_from_buffer and you should be good to go! See release version 0.1.1

ssalvate commented 3 years ago

I copied over your example project, then uncommented the 2 lines for the png code, but I still get the same error complaining that its is not a png file

Error

Does this work on your phone? Am I doing something wrong?

Lamelynx commented 3 years ago

It's works for me. In the example project you need to push "100x100..." button to set the png option.

ssalvate commented 3 years ago

I cannot tell what the "set image to 100*100 but keep aspect ratio button is doing"? But the png images I am loading are still losing their transparency.

image

Im getting the image on the right when I use 'loadjpg..", and that error when loading with "load_png..", I want the image on the left

ssalvate commented 3 years ago

Apologies,(its a little late for me here) It is working. I just was doing it wrong, now I get what you were saying. Gotta press that button first, then load png. I appreciate the fast responses.

Lamelynx commented 3 years ago

Great :-)