diff --git a/.SRCINFO b/.SRCINFO
index dc36664..78b483a 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
 pkgbase = exact-image
 	pkgdesc = Fast image manipulation programs
-	pkgver = 1.0.2
-	pkgrel = 4
+	pkgver = 1.2.1
+	pkgrel = 1
 	url = http://exactcode.com/opensource/exactimage/
 	arch = i686
 	arch = x86_64
@@ -10,9 +10,9 @@ pkgbase = exact-image
 	depends = jasper
 	depends = expat
 	depends = libtiff
-	source = http://dl.exactcode.de/oss/exact-image/exact-image-1.0.2.tar.bz2
-	source = exact-image-1.0.2.patch
-	sha256sums = 0694c66be5dec41377acead475de69b3d7ffb42c702402f8b713f8b44cdc2791
-	sha256sums = 0fd1f388c5d947df9bf71cfc822de2f3b25121dfe76dced1af89253df93df3b9
+	source = http://dl.exactcode.de/oss/exact-image/exact-image-1.2.1.tar.bz2
+	source = exact-image-1.2.1.patch
+	sha256sums = 7843cf35db40f3a2caed3d0b11256e226ef16169244ca2dc1c89af86ac8a148a
+	sha256sums = 6a7c01b8a805c25bf628d0a9951fd03cd366a20b69c8210dba1aa41d33cd81f7
 
 pkgname = exact-image
diff --git a/PKGBUILD b/PKGBUILD
index 2da4bd0..f000eab 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,8 +3,8 @@
 # Contributor: Stefan Husmann <stefan-husmann@t-online.de>
 
 pkgname=exact-image
-pkgver=1.0.2
-pkgrel=4
+pkgver=1.2.1
+pkgrel=1
 pkgdesc="Fast image manipulation programs"
 arch=('i686' 'x86_64')
 url="http://exactcode.com/opensource/exactimage/"
@@ -12,8 +12,8 @@ license=('GPL2')
 depends=('agg' 'jasper' 'expat' 'libtiff')
 source=("http://dl.exactcode.de/oss/exact-image/$pkgname-$pkgver.tar.bz2"
         "$pkgname-$pkgver.patch")
-sha256sums=('0694c66be5dec41377acead475de69b3d7ffb42c702402f8b713f8b44cdc2791'
-            '0fd1f388c5d947df9bf71cfc822de2f3b25121dfe76dced1af89253df93df3b9')
+sha256sums=('7843cf35db40f3a2caed3d0b11256e226ef16169244ca2dc1c89af86ac8a148a'
+            '6a7c01b8a805c25bf628d0a9951fd03cd366a20b69c8210dba1aa41d33cd81f7')
 
 prepare() {
 	cd "$pkgname-$pkgver"
diff --git a/exact-image-1.2.1.patch b/exact-image-1.2.1.patch
new file mode 100644
index 0000000..f149c98
--- /dev/null
+++ b/exact-image-1.2.1.patch
@@ -0,0 +1,104 @@
+diff -ruN a/api/perl/Makefile b/api/perl/Makefile
+--- a/api/perl/Makefile	2019-09-29 22:52:17.000000000 +0200
++++ b/api/perl/Makefile	2024-01-18 07:37:56.929612791 +0100
+@@ -20,5 +20,5 @@
+ all:: $($(X_MODULE)_BINARY)
+ install:: $($(X_MODULE)_BINARY)
+ 	$(Q)echo "INSTALL PERL module $^"
+-	$(Q)mkdir -p $(DESTDIR)$(libdir)/perl5/site_perl/
+-	$(Q)install $^ $(dir $^)/ExactImage.pm $(DESTDIR)$(libdir)/perl5/site_perl/
++	$(Q)mkdir -p $(DESTDIR)$(libdir)/perl5/5.38/vendor_perl/
++	$(Q)install $^ $(dir $^)/ExactImage.pm $(DESTDIR)$(libdir)/perl5/5.38/vendor_perl/
+diff -ruN a/codecs/jpeg2000.cc b/codecs/jpeg2000.cc
+--- a/codecs/jpeg2000.cc	2017-07-21 16:19:01.000000000 +0200
++++ b/codecs/jpeg2000.cc	2024-01-18 21:59:53.570548708 +0100
+@@ -67,14 +67,14 @@
+   return stream;
+ }
+ 
+-static int cpp_jas_read (jas_stream_obj_t* obj, char* buf, int cnt)
++static long int cpp_jas_read (jas_stream_obj_t* obj, char* buf, long unsigned int cnt)
+ {
+   std::istream* stream = (std::istream*) obj;
+   stream->read (buf, cnt);
+   return cnt;
+ }
+ 
+-static int cpp_jas_write (jas_stream_obj_t* obj, char* buf, int cnt)
++static long int cpp_jas_write (jas_stream_obj_t* obj, const char* buf, long unsigned int cnt)
+ {
+   std::ostream* stream = (std::ostream*) obj;
+   stream->write (buf, cnt);
+@@ -136,7 +136,20 @@
+   
+   jas_image_t* image;
+   jas_stream_t* in;
++  size_t mem;
+   
++  jas_conf_clear();
++  mem = jas_get_total_mem_size();
++  jas_conf_set_max_mem_usage(mem ? 0.90 * mem : JAS_DEFAULT_MAX_MEM_USAGE);
++  if (jas_init_library()) {
++    std::cerr << "error: jasper library initialization failed" << std::endl;
++    return false;
++  }
++  if (jas_init_thread()) {
++    std::cerr << "error: jasper per-thread initialization failed" << std::endl;
++    jas_cleanup_library();
++    return false;
++  }
+   if (!(in = jas_stream_create ())) {
+     std::cerr << "error: cannot create stream" << std::endl;
+     return false;
+@@ -149,7 +162,7 @@
+   
+   jas_stream_initbuf (in);
+   
+-  if (!(image = jp2_decode(in, 0))) {
++  if (!(image = jas_image_decode(in, jas_image_strtofmt("jp2"), 0))) {
+     std::cerr << "error: cannot load image data" << std::endl;
+     return false;
+   }
+@@ -251,6 +264,8 @@
+   }
+   
+   jas_image_destroy (image);
++  jas_cleanup_thread();
++  jas_cleanup_library();
+   return true;
+ }
+ 
+@@ -260,7 +275,20 @@
+ {
+   jas_image_t* image;
+   jas_stream_t* out;
++  size_t mem;
+   
++  jas_conf_clear();
++  mem = jas_get_total_mem_size();
++  jas_conf_set_max_mem_usage(mem ? 0.90 * mem : JAS_DEFAULT_MAX_MEM_USAGE);
++  if (jas_init_library()) {
++    std::cerr << "error: jasper library initialization failed" << std::endl;
++    return false;
++  }
++  if (jas_init_thread()) {
++    std::cerr << "error: jasper per-thread initialization failed" << std::endl;
++    jas_cleanup_library();
++    return false;
++  }
+   if (!(out = jas_stream_create ())) {
+     std::cerr << "error: cannot create stream" << std::endl;
+     return false;
+@@ -324,9 +352,11 @@
+ 
+   std::stringstream opts;
+   opts << "rate=" << (double)quality / 100;
+-  jp2_encode(image, out, (char*)opts.str().c_str());
++  jas_image_encode(image, out, jas_image_strtofmt("jp2"), (char*)opts.str().c_str());
+   jas_image_destroy (image);
+   jas_stream_close (out);
++  jas_cleanup_thread();
++  jas_cleanup_library();
+   
+   return true;
+ }
