diff --git a/CMakeLists.txt b/CMakeLists.txt
index 12d7c437b3d323f549ee212953d1137f83208b22..63adf0a1094e612b30223a5dc3ec30767f01c8fb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,6 +37,8 @@ option(USE_MESA "use software rendered Mesa instead of hardware GL"
       OFF)
 option(ENABLE_IMG "whether the image processing module should be compiled"
        ON)
+option(ENABLE_PNG_TIFF "whether the img module should compiled with PNG/TIFF support"
+       ON)
 option(ENABLE_INFO "whether openstructure should be compiled with support for the info library"
        ON)
 option(USE_NUMPY "whether numpy support is added"
@@ -88,6 +90,10 @@ else()
   set(_DOUBLE_PREC OFF)
 endif()
 
+if (NOT ENABLE_TIFF_PNG)
+  set(ENABLE_GFX OFF)
+endif()
+
 if (NOT ENABLE_INFO)
   set(ENABLE_GFX OFF)
 endif()
@@ -199,7 +205,9 @@ if (ENABLE_GFX)
 endif()
 
 if (ENABLE_IMG OR ENABLE_GFX)
-  find_package(PNG REQUIRED)
+  if (ENABLE_TIFF_PNG)
+    find_package(PNG REQUIRED)
+  endif()
 else()
   set (PNG_LIBRARY "")
 endif()
@@ -213,8 +221,10 @@ endif()
 
 if (ENABLE_IMG)
   find_package(FFTW REQUIRED)
+if (ENABLE_TIFF_PNG)
   find_package(TIFF REQUIRED)
 endif()
+endif()
 
 
 if (ENABLE_STATIC)
diff --git a/modules/config/CMakeLists.txt b/modules/config/CMakeLists.txt
index 4f7e645ae21730204495c46ce91bc624bf4b28bb..af433277e4ca9a9142a74c914cd2bcfd8d7a1751 100644
--- a/modules/config/CMakeLists.txt
+++ b/modules/config/CMakeLists.txt
@@ -32,6 +32,13 @@ if (PROFILE)
 else()
   set(profiling_enabled 0)
 endif()
+if (ENABLE_TIFF_PNG)
+  set(tiff_enabled 1)
+  set(png_enabled 1)
+else()
+  set(tiff_enabled 0)
+  set(png_enabled 0)
+endif()
 if (ENABLE_IMG)
   set(img_enabled 1)
 else()
diff --git a/modules/config/config.hh.in b/modules/config/config.hh.in
index 23027e24848ca02388701f86b32bc68530829840..86c47021a641099adea33b8449205c97847b9622 100644
--- a/modules/config/config.hh.in
+++ b/modules/config/config.hh.in
@@ -28,6 +28,8 @@
 #define OST_PROFILING_ENABLED @profiling_enabled@
 #define OST_ANIMATIONS_ENABLED @animations_enabled@
 #define OST_IMG_ENABLED @img_enabled@
+#define OST_PNG_ENABLED @png_enabled@
+#define OST_TIFF_ENABLED @tiff_enabled@
 #define OST_DOUBLE_PRECISION @double_prec@
 #define OST_STATIC_PROPERTY_WORKAROUND @static_props@
 #define OST_FFT_USE_THREADS @fftw_use_threads@
diff --git a/modules/io/pymod/export_map_io.cc b/modules/io/pymod/export_map_io.cc
index f28cae62e062eea731235870dccf59dc00f4515c..688f8b4c336368609d0ac4c4dfbd4f89030ff2db 100644
--- a/modules/io/pymod/export_map_io.cc
+++ b/modules/io/pymod/export_map_io.cc
@@ -23,10 +23,14 @@
 #include  <ost/io/img/map_io_mrc_handler.hh>
 #include  <ost/io/img/map_io_dm3_handler.hh>
 #include  <ost/io/img/map_io_situs_handler.hh>
+#if OST_TIFF_ENABLED
 #include  <ost/io/img/map_io_tiff_handler.hh>
+#include  <ost/io/img/map_io_jpk_handler.hh>
+#endif
+#if OST_PNG_ENABLED
 #include  <ost/io/img/map_io_png_handler.hh>
+#endif
 #include  <ost/io/img/map_io_dat_handler.hh>
-#include  <ost/io/img/map_io_jpk_handler.hh>
 #include  <ost/io/img/map_io_nanoscope_handler.hh>
 #include  <ost/io/img/map_io_ipl_handler.hh>
 #include  <ost/io/img/image_format.hh>
@@ -58,10 +62,6 @@ img::ImageHandle  load_image2(const String& loc, const ImageFormatBase& formatst
 
 void export_map_io()
 {
-  class_<boost::logic::tribool>("tribool", init<boost::logic::tribool>())
-    .def(init<bool>())
-  ;
-  implicitly_convertible<bool,boost::logic::tribool>();
 
   enum_<Endianess>("Endianess")
         .value("OST_BIG_ENDIAN", OST_BIG_ENDIAN)
@@ -133,7 +133,11 @@ void export_map_io()
     .def("SetNormalizeOnSave", &Situs::SetNormalizeOnSave)
     .def("GetNormalizeOnSave", &Situs::GetNormalizeOnSave)
   ;
-
+#if OST_TIFF_ENABLED
+  class_<boost::logic::tribool>("tribool", init<boost::logic::tribool>())
+    .def(init<bool>())
+  ;
+  implicitly_convertible<bool,boost::logic::tribool>();
   class_<TIF, bases<ImageFormatBase> >("TIF", init<boost::logic::tribool,Format,bool,bool,int>
 				       ((arg("normalize_on_save") =  boost::logic::tribool(boost::logic::indeterminate),arg("format")=OST_DEFAULT_FORMAT,arg("signed")=false,arg("phasecolor")=false,arg("subimage") = -1)))
     .def("SetNormalizeOnSave", &TIF::SetNormalizeOnSave)
@@ -149,12 +153,19 @@ void export_map_io()
     .def("SetSubimage", &TIF::SetSubimage)
     .def("GetSubimage", &TIF::GetSubimage)
   ;
+  class_<JPK, bases<TIF> >("JPK", init<boost::logic::tribool,Format,bool,bool,int>
+           ((arg("normalize_on_save") =  boost::logic::tribool(boost::logic::indeterminate),arg("format")=OST_DEFAULT_FORMAT,arg("signed")=false,arg("phasecolor")=false,arg("subimage") = -1)))
+  ;
 
+  class_<Nanoscope, bases<ImageFormatBase> >("Nanoscope", init <int>(arg("subimage")=-1))
+#endif
+
+#if OST_PNG_ENABLED
   class_<PNG, bases<ImageFormatBase> >("PNG", init<bool>(arg("normalize_on_save") = false))
     .def("SetNormalizeOnSave", &PNG::SetNormalizeOnSave)
     .def("GetNormalizeOnSave", &PNG::GetNormalizeOnSave)
   ;
-
+#endif
   class_<DAT, bases<ImageFormatBase> >("DAT", init<bool,Format,bool,Endianess>((arg("normalize_on_save") = false,arg("format")=OST_DEFAULT_FORMAT,arg("signed")=false,arg("endianess") = OST_LOCAL_ENDIAN)))
     .def("SetNormalizeOnSave", &DAT::SetNormalizeOnSave)
     .def("GetNormalizeOnSave", &DAT::GetNormalizeOnSave)
@@ -171,11 +182,6 @@ void export_map_io()
     .def("GetBitDepth", &IPL::GetBitDepth)
   ;
 
-  class_<JPK, bases<TIF> >("JPK", init<boost::logic::tribool,Format,bool,bool,int>
-           ((arg("normalize_on_save") =  boost::logic::tribool(boost::logic::indeterminate),arg("format")=OST_DEFAULT_FORMAT,arg("signed")=false,arg("phasecolor")=false,arg("subimage") = -1)))
-  ;
-
-  class_<Nanoscope, bases<ImageFormatBase> >("Nanoscope", init <int>(arg("subimage")=-1))
   ;
 
   def("SaveImage",save_image1);
diff --git a/modules/io/src/img/CMakeLists.txt b/modules/io/src/img/CMakeLists.txt
index d17f46e8ec5e043b1a74c67ee900e5e01271ccd7..56133f92aa48fdec4b545bde2a9ffd6524a9b5df 100644
--- a/modules/io/src/img/CMakeLists.txt
+++ b/modules/io/src/img/CMakeLists.txt
@@ -5,19 +5,16 @@ map_io_spi_handler.cc
 map_io_situs_handler.cc
 map_io_mrc_handler.cc
 map_io_dm3_handler.cc
-map_io_tiff_handler.cc
 map_io_dat_handler.cc
 map_io_ipl_handler.cc
-map_io_jpk_handler.cc
 map_io_nanoscope_handler.cc
-map_io_png_handler.cc
 map_io_df3_handler.cc
 convert_vax_data.c
 image_format.cc
-tiff_util.cc
 PARENT_SCOPE
 )
 
+
 set(OST_IO_IMG_HEADERS
 load_map.hh
 map_io_df3_handler.hh
@@ -40,3 +37,10 @@ tiff_util.hh
 jpk_util.hh
 PARENT_SCOPE
 )
+
+if (ENABLE_TIFF_PNG)
+  list(OST_IO_IMG_SOURCES map_io_jpk_handler.cc
+       map_io_png_handler.cc map_io_iff_handler.cc tiff_util.cc)
+  list(OST_IO_IMG_HEADERS map_io_jpk_handler.hh
+       map_io_png_handler.hh map_io_iff_handler.hh tiff_util.hh)
+endif()
diff --git a/modules/io/src/io_manager.cc b/modules/io/src/io_manager.cc
index 6edc7fe430dd928159152bed7ebea0bde53aeb44..ed8f01fc31ba3e219d6e0b0b1f24140801a72c1c 100644
--- a/modules/io/src/io_manager.cc
+++ b/modules/io/src/io_manager.cc
@@ -33,10 +33,14 @@
 #  include  <ost/io/img/map_io_mrc_handler.hh>
 #  include  <ost/io/img/map_io_dm3_handler.hh>
 #  include  <ost/io/img/map_io_situs_handler.hh>
+#if OST_TIFF_ENABLED
 #  include  <ost/io/img/map_io_tiff_handler.hh>
+#  include  <ost/io/img/map_io_jpk_handler.hh>
+#endif
+#if OST_PNG_ENABLED
 #  include  <ost/io/img/map_io_png_handler.hh>
+#endif
 #  include  <ost/io/img/map_io_dat_handler.hh>
-#  include  <ost/io/img/map_io_jpk_handler.hh>
 #  include  <ost/io/img/map_io_nanoscope_handler.hh>
 #  include  <ost/io/img/map_io_df3_handler.hh>
 #  include  <ost/io/img/map_io_ipl_handler.hh>
@@ -61,9 +65,13 @@ IOManager::IOManager()
   RegisterFactory(MapIOHandlerFactoryBasePtr(new MapIOSitusHandlerFactory));
   RegisterFactory(MapIOHandlerFactoryBasePtr(new MapIOMrcHandlerFactory));
   RegisterFactory(MapIOHandlerFactoryBasePtr(new MapIODm3HandlerFactory));
+#if OST_TIFF_ENABLED
   RegisterFactory(MapIOHandlerFactoryBasePtr(new MapIOTiffHandlerFactory));
-  RegisterFactory(MapIOHandlerFactoryBasePtr(new MapIOPngHandlerFactory));
   RegisterFactory(MapIOHandlerFactoryBasePtr(new MapIOJpkHandlerFactory));
+#endif
+#if OST_PNG_ENABLED
+  RegisterFactory(MapIOHandlerFactoryBasePtr(new MapIOPngHandlerFactory));
+#endif
   RegisterFactory(MapIOHandlerFactoryBasePtr(new MapIODatHandlerFactory));
   RegisterFactory(MapIOHandlerFactoryBasePtr(new MapIONanoscopeHandlerFactory));
   RegisterFactory(MapIOHandlerFactoryBasePtr(new MapIODF3HandlerFactory));
diff --git a/modules/io/tests/test_io_img.cc b/modules/io/tests/test_io_img.cc
index 890a7a9c29a22beb57b4c7c0aa0ffb04273f8777..82dc2116c3d18fc9385141aee97fa930e6d2c337 100644
--- a/modules/io/tests/test_io_img.cc
+++ b/modules/io/tests/test_io_img.cc
@@ -29,10 +29,14 @@
 #include  <ost/io/img/map_io_mrc_handler.hh>
 #include  <ost/io/img/map_io_dm3_handler.hh>
 #include  <ost/io/img/map_io_situs_handler.hh>
+#if OST_TIFF_ENABLED
 #include  <ost/io/img/map_io_tiff_handler.hh>
+#include  <ost/io/img/map_io_jpk_handler.hh>
+#endif
+#if OST_PNG_ENABLED
 #include  <ost/io/img/map_io_png_handler.hh>
+#endif
 #include  <ost/io/img/map_io_dat_handler.hh>
-#include  <ost/io/img/map_io_jpk_handler.hh>
 #include  <ost/io/img/map_io_nanoscope_handler.hh>
 #include  <ost/io/img/map_io_ipl_handler.hh>
 #include  <ost/img/alg/normalizer_factory.hh>
@@ -60,10 +64,12 @@ BOOST_AUTO_TEST_CASE(test_io_img)
   float_formats["CCP4 (float)"]=new MRC;
   float_formats["MRC (float)"]=new MRC(false,MRC_OLD_FORMAT);
   float_formats["SPIDER"]= new Spider;
+#if OST_TIFF_ENABLED
   float_formats["JPK (float)"]= new JPK(false,OST_FLOAT_FORMAT);
   float_formats["JPK (double)"]= new JPK(false,OST_DOUBLE_FORMAT);
   float_formats["TIF (float)"]= new TIF(false,OST_FLOAT_FORMAT);
   float_formats["TIF (double)"]= new TIF(false,OST_DOUBLE_FORMAT);
+#endif
   for(std::map<String,ImageFormatBase*>::iterator it=float_formats.begin();it!=float_formats.end();++it){
     ost::io::SaveImage(testimage,fname,*(it->second));
     ost::img::ImageHandle loadedimage=ost::io::LoadImage(fname,*(it->second));
@@ -83,8 +89,10 @@ BOOST_AUTO_TEST_CASE(test_io_img)
   //int 16 formats
   std::map<String,ImageFormatBase*> int_formats;
   int_formats["IPL (16 bit)"]=new IPL(true,OST_BIT16_FORMAT);
+#if OST_TIFF_ENABLED
   int_formats["TIF (16 bit)"]=new TIF;
   int_formats["JPK (16 bit)"]=new JPK;
+#endif
   // int_formats["DF3"]=new DF3(true);
   for(std::map<String,ImageFormatBase*>::iterator it=int_formats.begin();it!=int_formats.end();++it){
     ost::io::SaveImage(testimage,fname,*(it->second));
@@ -135,9 +143,13 @@ BOOST_AUTO_TEST_CASE(test_io_img)
 
   //byte formats  
   std::map<String,ImageFormatBase*> byte_formats;
+#if OST_PNG_ENABLED
   byte_formats["PNG"]=new PNG;
-  byte_formats["JPK (byte)"]= new JPK(true,OST_BIT8_FORMAT);
+#endif
+#if OST_TIFF_ENABLED
   byte_formats["TIF (byte)"]= new TIF(true,OST_BIT8_FORMAT);
+  byte_formats["JPK (byte)"]= new JPK(true,OST_BIT8_FORMAT);
+#endif
   for(std::map<String,ImageFormatBase*>::iterator it=byte_formats.begin();it!=byte_formats.end();++it){
     ost::io::SaveImage(testimage,fname,*(it->second));
     ost::img::ImageHandle loadedimage=ost::io::LoadImage(fname,*(it->second));