Hack Forums
[C#] Dynamic Image->Bitmap issue - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] Dynamic Image->Bitmap issue (/showthread.php?tid=5993008)



Dynamic Image->Bitmap issue - DNA - Jul 25, 2019

So here's the deal...

I have a method that determines the location of a sample bitmap image, however I am unable to use any image that isn't loaded from Properties.Resources.

At most I was able to save and load from a resx file but this did not produce the same results and using ResouceWriter and ResourceReader failed as well (no exceptions, simply returns null).

What I need is to be able to either
A: Save and Load from Resources in the shortest way possible (preferably using overload parameters)
Or
B: Change an image to be the exact same bitmap output that resources would produce, whatever that result may be.

Essentially I am trying to use images on an array as bitmap images.

I have tried the standard
"(Bitmap) image/ Image newImage = new Bitmap(image);" methods, but this fails.

Any suggestions are highly appreciated.

Code
//Invalid Example:
bool isValid = FindBitmap((Bitmap)image, screenshot, out location);

//Valid Example:
bool isValid = FindBitmap(Properties.Resources.PresavedImage, screenshot, out location);

Resolved:
Issue was that the bitmap size was not relative to the image size.