diff --git a/filter/tex/filter.php b/filter/tex/filter.php
index d067fbc..156a115 100644
--- a/filter/tex/filter.php
+++ b/filter/tex/filter.php
@@ -164,7 +164,7 @@ function tex_filter ($courseid, $text) {
             $texcache->timemodified = time();
             insert_record("cache_filters",$texcache, false);
         }
-        $filename = $md5 . ".gif";
+        $filename = $md5 . ".png";
         $text = str_replace( $matches[0][$i], string_file_picture_tex($filename, $texexp, '', '', $align, $alt), $text);
     }
     return $text;
diff --git a/filter/tex/latex.php b/filter/tex/latex.php
index 5386b2b..d339eba 100644
--- a/filter/tex/latex.php
+++ b/filter/tex/latex.php
@@ -106,7 +106,7 @@
             $tex = "{$this->temp_dir}/$filename.tex";
             $dvi = "{$this->temp_dir}/$filename.dvi";
             $ps  = "{$this->temp_dir}/$filename.ps";
-            $gif = "{$this->temp_dir}/$filename.gif";
+            $gif = "{$this->temp_dir}/$filename.png";
 
             // turn the latex doc into a .tex file in the temp area
             $fh = fopen( $tex, 'w' );
@@ -149,7 +149,7 @@
             unlink( "{$this->temp_dir}/$filename.tex" );
             unlink( "{$this->temp_dir}/$filename.dvi" );
             unlink( "{$this->temp_dir}/$filename.ps" );
-            unlink( "{$this->temp_dir}/$filename.gif" );
+            unlink( "{$this->temp_dir}/$filename.png" );
             unlink( "{$this->temp_dir}/$filename.aux" );
             unlink( "{$this->temp_dir}/$filename.log" );
             return;
diff --git a/filter/tex/pix.php b/filter/tex/pix.php
index 457703e..190835b 100644
--- a/filter/tex/pix.php
+++ b/filter/tex/pix.php
@@ -40,7 +40,7 @@
     }
 
     if (!file_exists($pathname)) {
-        $md5 = str_replace('.gif','',$image);
+        $md5 = str_replace('.png','',$image);
         if ($texcache = get_record('cache_filters', 'filter', 'tex', 'md5key', $md5)) {
             if (!file_exists($CFG->dataroot.'/filter/tex')) {
                 make_upload_directory('filter/tex');
