saved lenght to a varible
saved query in a varible out loop
saved query in a varible
removed img creation from for loop
removed determineDX from loop
removed size from loop
compress png file