I have some code in place that allows loading images from a browse dialogue. I then use the file reference data as a byteArray that I can load into bitmaps for display purposes. I perform checks on the file size to ensure it is not greater than a certain megapixel amount, ensuring an image cannot be loaded that is greater than the 16M limit.
I have noticed, however, that it is possible to have images with very low compression that exceed the 8,192 pixel height or width limit, which will cause loadBytes to fail without firing any errors or complete events. I have not found a solution to this issue, but I am still looking.
Basically, I need to validate the width and height of an image so that I can decide whether to allow it, but I don't have access to these values until it is loaded. Of course, I would be happy with some way of telling if the loading failed for some reason at this point, but nothing I have read so far seems to be able to get around this problem.
To test this scenario I created a JPEG image that is 8193x2049 and saved via Photoshop with the lowest possible quality. The file size itself is only 188k so it gets by the initial loading size check, but using loadBytes with the data simply doesn't return any events or failures that I can hook into.
Is there any way to validate the byteArray in this case to make the decision not to call loadBytes? I can't rely on checking the raw data, since I cannot assume filetype, so I was wondering if there are alternatives or if anyone else has run into this problem and found a workaround.