26 #ifndef __BIAS_IMAGEIO_H__
27 #define __BIAS_IMAGEIO_H__
29 #include "bias_config.h"
34 #include "MetaData.hh"
36 #define MIP_IDENTIFIER "MIP"
37 #define MIP_IDENTIFIER_LENGTH 3
39 #define UNKNOWN_META_DATA -5
42 #define BIAS_DEFAULT_IMAGE_QUALITY 80
43 #define BIAS_DEFAULT_SYNC false
44 #define BIAS_DEFAULT_FORCENEWID true
48 #define BIAS_IO_SUCCESS 0
50 #ifdef BIAS_HAVE_OPENEXR
52 # pragma warning( push, 1)
53 # define PLATFORM_WINDOWS
55 # include <ImfPixelType.h>
57 # pragma warning( pop)
103 static int Load(
const std::string& FileName,
ImageBase& img);
115 static int ImportImage(
const std::string& filename,
ImageBase &result );
129 static int Save(
const std::string& filename,
131 const enum TFileFormat FileFormat=FF_auto,
132 const bool sync = BIAS_DEFAULT_SYNC,
133 const int c_jpeg_quality=BIAS_DEFAULT_IMAGE_QUALITY,
134 const bool forceNewID = BIAS_DEFAULT_FORCENEWID,
135 const bool & writeMetaData=
true);
140 static int WriteRAW_IMA(
const std::string& FileName,
146 static int WriteUnbuffered(
const std::string& FileName,
160 static int ImportMatrix(
const std::string &FileName,
175 static int ExportMatrix(
const std::string &FileName,
185 static std::string ExtensionName(
const std::string & oldName,
186 const std::string & newExtension);
188 #ifdef BIAS_HAVE_LIBJPEG
197 static int ImportLibJPEG(
const std::string &filename,
199 bool readComment =
true);
210 static int ExportLibJPEG(
const std::string &filename,
212 const int quality = 100);
213 #endif // BIAS_HAVE_LIBJPEG
216 #ifdef BIAS_HAVE_IMAGEMAGICKLIB
233 static int ImportMagickPPAutoconvert(
const std::string& FileName,
235 const bool &assumeGrey=
false,
236 const bool &readMetaData=
false );
247 static int ImportMagickPP(
const std::string & FileName,
249 const bool & dummy =
false,
250 const bool & readMetaData =
true);
276 static int ExportMagickPP(
const std::string& FileName,
278 const int &quality=BIAS_DEFAULT_IMAGE_QUALITY,
279 const bool &writeMetaData=
false,
280 const bool &forceBinaryPNMformat=
true,
281 const bool &losslesJpgMode=
false,
282 const bool &writeGZipped=
false,
283 const std::string & comment=std::string(
"")
285 #endif // BIAS_HAVE_IMAGEMAGICKLIB
289 #ifdef BIAS_HAVE_OPENCV
297 static int ImportOpenCV(
const std::string &filename,
ImageBase &image);
305 static int ExportOpenCV(
const std::string &filename,
const ImageBase &image);
307 #endif // BIAS_HAVE_OPENCV
311 #ifdef BIAS_HAVE_OPENEXR
315 static int ImportOpenEXR(
const std::string& FileName,
ImageBase& result);
319 static int ExportOpenEXR(
const std::string& FileName,
321 #endif // BIAS_HAVE_OPENEXR
325 #ifdef BIAS_HAVE_DEVIL
340 static int ImportDevIL(
const std::string& FileName,
342 const unsigned int & tex3DplaneZ=1);
357 static int ExportDevIL(
const std::string& FileName,
359 const bool &fileOverwrite=
true,
360 const bool &allowPadding=
true );
366 static void InitDevIL();
370 static void PrintInfoDevIL(std::ostream & os=std::cout);
372 #endif // BIAS_HAVE_DEVIL
411 static int ImportRAWwithHeader(
const std::string & filename,
419 static int ParseRAWwithHeader(
const std::string & buf,
420 const std::string & tag,
421 unsigned int & retVal);
430 static int ImportRADIANCE(
const std::string& FileName,
ImageBase& result);
452 static int ImportReal32(
const std::string& FileName,
ImageBase& result);
471 static int Import_BITMAP_winapi(
const std::string& FileName,
473 const bool flipY=
true);
477 static int BIAS::ImageIO::Import_HBITMAP_winapi(
const HBITMAP & hbm,
479 const bool flipY=
true );
483 static int BIAS::ImageIO::Import_BITMAP_winapi(
const BITMAP & bm,
485 const bool flipY=
true );
491 # define BIAS_COMPRESSION_NONE 1
492 # define BIAS_COMPRESSION_LZW 5
493 # define BIAS_COMPRESSION_DEFLATE 32946
494 #ifdef BIAS_HAVE_TIFF
501 static int ExportTIFFLIB(
const std::string& FileName,
503 const unsigned int rowsPerStripArg=0,
504 const unsigned int compressionAlgo=BIAS_COMPRESSION_NONE,
505 const std::string & comment=std::string(
"BIAS::ImageIO Jan Woetzel") );
509 static int ImportTIFFLIB(
const std::string& FileName,
ImageBase& img );
524 static int ImportImagePnm_(std::ifstream& ifs,
ImageBase &result,
526 static int ExportImagePnm_(
const std::string &FileName,
529 const bool & writeMetaData=
true);
536 static int ImportImageViff_(std::ifstream& ifs,
ImageBase &result);
549 static int Read_(
const std::string& FileName,
ImageBase &img);
561 static int Write_(
const std::string& FileName,
const ImageBase &img,
562 const bool sync=
false,
const bool forceNewID =
true);
Routines for loading and writing all kinds of image formats.
TFileFormat
format specifier when writing an image to a file Do NOT change order or associated enum value because...
static unsigned long int MemAlignedBufferSize_
static char * MemAlignedBuffer_
This is the base class for images in BIAS.