diff -up g2clib-1.4.0/enc_jpeg2000.c.jasper2 g2clib-1.4.0/enc_jpeg2000.c
--- g2clib-1.4.0/enc_jpeg2000.c.jasper2 2012-02-15 06:54:35.000000000 -0700
+++ g2clib-1.4.0/enc_jpeg2000.c 2016-12-05 13:28:09.922064726 -0700
@@ -121,7 +121,9 @@ int enc_jpeg2000(unsigned char *cin,g2in
image.clrspc_=JAS_CLRSPC_SGRAY; /* grayscale Image */
image.cmprof_=0;
#endif
+#if JAS_VERSION_MAJOR == 1
image.inmem_=1;
+#endif
cmpt.tlx_=0;
cmpt.tly_=0;