Merge pull request #265 from hwhw/master

convert pic_jpeg interface to pure Lua/FFI solution
fix off-by-one in writePNG() method
fix RGB16 to 8bit grayscale conversion