Load image from EmbeddedResource
See original GitHub issueBefore submitting a new issue, please verify and check:
- The issue is specific to Raylib-cs and not raylib
- I checked there is no similar issue already reported
- My code has no errors or misuse of Raylib-cs
Issue description
I would like to be able to load an image file using embedded resources and convert this to a Raylib_cs.Image/Texture
Environment
Code example
My current code:
var myStream = Program.game.GetType().Assembly.GetManifestResourceStream(path);
var image = System.Drawing.Image.FromStream(myStream);
return Raylib.LoadTextureFromImage(image);
Throws the error:
error CS1503: Argument 1: cannot convert from 'System.Drawing.Image' to 'Raylib_cs.Image'
There may already be a way to do this, but I couldn’t find one in the examples or looking at the lib’s code. The Go raylib library provides a NewImageFromImage
function that converts a native go Image into a Raylib one, so something like that would probably do
Thanks
Issue Analytics
- State:
- Created a year ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Load image from resources area of project in C# - ...
myimage. This will get the image via a generated C# property. If you just set the image as Embedded Resource you can get...
Read more >Embedded Image Resources
Add Image Resource · In Visual Studio, click the Project menu, and select Add Existing Item. · In the Solution Explorer window, right-click...
Read more >How to read a embedded resource image in C# and VB.NET
ByAdministrator. To read a embedded resource image in C# and VB.NET you can use the following snippet.
Read more >How to load embebbed resource image in WPF?
To embed an image as a resource, add it to your project and set its Build Action to Resource. You can access this...
Read more >How to load image with embedded and from URL in ...
This article explains to load images from URL and embedded resource in the SfRichTextEditor. Step 1: Create a SfRichTextEditor sample with all the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You could always combine the files after building (e.g.
copy /b Game.exe + Resources.rres GameWithResources.exe
) and then split them up again at runtime by looking for therres
Magic Bytes (HEX:72 72 65 73
).I am currently developing an rres parser for use with Raylib-cs, so I will take this use-case under consideration
@JupiterRider cheers for that, it seems to be working well.
Many thanks 👍