also, if you use "limit / 2" maybe you can use the original blob ? Because here you'll probably have with a very damaged file (because of the "quality = 0") in resizedblob.