MMMagic
MMMagic

Reputation: 182

System.drawing.Image PathTooLong

I need to handle Images with really long paths (no way to save to shorter paths because files already exist in company). For the System.IO.path I had the same problem and found AlphaFS (can handle long paths way over 260 chars), which works perfectly. Is there any way to do the same thing for the System.drawing.Image class? Id need that in general, but as an example I get the PathTooLong-Exception when calling Image.FromFile(path);

Upvotes: 0

Views: 122

Answers (1)

Patrick Hofman
Patrick Hofman

Reputation: 156978

No, there is not. You could load the file yourself, and then read the image from a stream:

using (MemoryStream ms = new MemoryStream(yourOwnReadBytes))
{
    Image i = Image.FromStream(ms);
}

Upvotes: 1

Related Questions