Bug 848916 - don't open images that are too big r=dkuo(cherry picked fro...

...m commit 42a42678460ca9c04add2485823222113003dd6c)

(cherry picked from commit 81477ddd436aab2df616a8faadd850c76cf1e7a6)