You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have var image = ImageFile.FromFile(pathToImage);
Can an Extension ToByteArray() on ImageFile be easily implemented as shown below? I can easily implement from IO Stream but since the file is already open for getting Exif metadata, I am trying to avoid opening for getting IO Stream.
An alternative question is can ImageFile be converted to MemoryStream which allows me to get to a byte array?
Apologies as I am new to ImageFile.
byte[] imageData = image.ToByteArray();
publicstaticclassMyExtensions{publicstaticbyte[]ToByteArray(thisImageFileimageFile){varmemoryStream=<## Get MemoryStream from imageFile ##>returnmemoryStream.ToArray();}}
UPDATE after a few hours:
I think I figured out?? but someone correct me if wrong;
I have
var image = ImageFile.FromFile(pathToImage);
Can an Extension
ToByteArray()
on ImageFile be easily implemented as shown below? I can easily implement from IOStream
but since the file is already open for getting Exif metadata, I am trying to avoid opening for getting IOStream
.An alternative question is can
ImageFile
be converted toMemoryStream
which allows me to get to a byte array?Apologies as I am new to
ImageFile
.byte[] imageData = image.ToByteArray();
UPDATE after a few hours:
I think I figured out?? but someone correct me if wrong;
The text was updated successfully, but these errors were encountered: