func setupEncoderOptions(cinfo *C.struct_jpeg_compress_struct, opt *EncoderOptions) { C.jpeg_set_quality(cinfo, C.int(opt.Quality), C.TRUE) if opt.OptimizeCoding { cinfo.optimize_coding = C.TRUE } else { cinfo.optimize_coding = C.FALSE } cinfo.dct_method = C.J_DCT_METHOD(opt.DCTMethod) }