Skip to content

Commit 89862b8

Browse files
authored
Change way to load bitmap from file (#1035)
* Change way to load bitmap * remove comments
1 parent c64660e commit 89862b8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

SharedProjects/Utilities/Texture/TextureUtilities.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public static bool GetMinimalBitmapDimensions(out int width, out int height, par
8989
return haveSameDimensions;
9090
}
9191

92+
private static readonly ImageConverter _imageConverter = new ImageConverter();
9293
public static Bitmap LoadTexture(string absolutePath, ILoggingProvider logger)
9394
{
9495
if (File.Exists(absolutePath))
@@ -114,7 +115,9 @@ public static Bitmap LoadTexture(string absolutePath, ILoggingProvider logger)
114115
case ".png":
115116
case ".tif":
116117
case ".tiff":
117-
return new Bitmap(absolutePath);
118+
{
119+
return (Bitmap)_imageConverter.ConvertFrom(File.ReadAllBytes(absolutePath));
120+
}
118121
default:
119122
logger.RaiseError(string.Format("Format of texture {0} is not supported by the exporter. Consider using a standard image format like jpg or png.", Path.GetFileName(absolutePath)), 3);
120123
return null;

0 commit comments

Comments
 (0)