speed optimization
add jpeg encode
add jpeg encode