Alex Rivera | Logout

validateImageData parameter and Image.FromStream()

Asked 2009-01-07T13:40:55.010
15

I'm concerned about the third parameter in this overload, validateImageData. The documentation doesn't explain much about it, it only states that it causes the image data to be validated but no details, what exactly is done to validate the image data?

public static Image FromStream (
    Stream stream,
    bool useEmbeddedColorManagement,
    bool validateImageData
)

I want to use this in a web application, so, I want to know what exactly will happen if I set validateImageData to true, I want to be sure that what the user uploads is a valid image, is it recommended to set validateImageData to true or is it enough to catch the exception if one is thrown? Also, can setting validateImageData to true affect the performance in any way? (users can upload images up to 250k in size)

Thanks

Edit
Report

1 Answer

0

Why not just try and see what happens with that flag set and not set?

In either case you should handle any exceptions that might get thrown.

answered 2009-01-07T13:51:16.330

Your Answer