flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik J. Thomas" <e...@linqto.com>
Subject Slow Image Sizing
Date Mon, 24 Apr 2017 18:45:50 GMT
Hey all:

My flex mobile app posts social chat messages with an optional image. It uses CameraRoll to
allow the user to select any image on their phone. But modern phones take HUGE pics. We don't
need full res photos for the chat and don't want to use up the bandwidth uploading full images
and resizing on the server.

The API we hit accepts an octet stream of bytes that represents the file. All this functions
fine, but it takes about 10 seconds to upload an HDR rear camera photo on an iPhone 6 Plus.

I'd like to resize it on the client. But using both PNG and JPG encoders are far too slow:

var bitmapData:BitmapData = new BitmapData(photo.width, photo.height, true, 0xffffff);
var jpegEncoder:JPEGEncoder = new JPEGEncoder();
urlRequest.data = jpegEncoder.encode(bitmapData); // this takes like 12 seconds for a 13 MB
iPhone 6 photo.

So uploading is the better solution from a user experience perspective because UI can remain
responsive while the async upload occurs. Resizing the image using an encoder cannot be done
asynchronously so it blocks UI and we can do nothing but show a busy cursor.

I don't like either solution. Someone out there have any ideas?

Thanks.

Erik


Mime
View raw message