ImfImageIO.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. // Copyright (c) Contributors to the OpenEXR Project.
  4. //
  5. #ifndef INCLUDED_IMF_IMAGE_IO_H
  6. #define INCLUDED_IMF_IMAGE_IO_H
  7. //----------------------------------------------------------------------------
  8. //
  9. // Functions to load flat or deep images from OpenEXR files
  10. // and to save flat or deep images in OpenEXR files.
  11. //
  12. //----------------------------------------------------------------------------
  13. #include "ImfUtilExport.h"
  14. #include "ImfImage.h"
  15. #include "ImfImageDataWindow.h"
  16. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
  17. //
  18. // saveImage (n, h, i, d) or
  19. // saveImage (n, i)
  20. //
  21. // Saves image i in an OpenEXR file with name n. The file will be
  22. // tiled if the image has more than one level, or if a header, h, is
  23. // given and contains a tile description attribute; otherwise the
  24. // file will be scan-line based. The file will be deep if the image
  25. // is deep; otherwise the file will be flat.
  26. //
  27. // If header h is given, then the channel list in h is replaced with
  28. // the channel list in i, and the levelMode and the levelRounding mode
  29. // fields of the tile description are replaced with the level mode
  30. // and the levelRounding mode of i. In addition, if the data window
  31. // source flag, d, is set to USE_IMAGE_DATA_WINDOW, then the data
  32. // window in the image is copied into the header; if d is set to
  33. // USE_HEADER_DATA_WINDOW, then the data window in the header is
  34. // replaced with the intersection of the original data window in the
  35. // header and the data window in the image. The modified header then
  36. // becomes the header of the image file.
  37. //
  38. // Note: USE_HEADER_DATA_WINDOW can only be used for images with
  39. // level mode ONE_LEVEL.
  40. //
  41. IMFUTIL_EXPORT
  42. void
  43. saveImage
  44. (const std::string &fileName,
  45. const Header &hdr,
  46. const Image &img,
  47. DataWindowSource dws = USE_IMAGE_DATA_WINDOW);
  48. IMFUTIL_EXPORT
  49. void
  50. saveImage
  51. (const std::string &fileName,
  52. const Image &img);
  53. //
  54. // loadImage (n, h) or
  55. // loadImage (n)
  56. //
  57. // Loads deep an image from the OpenEXR file with name n, and returns
  58. // a pointer to the image. The caller owns the image and is responsible
  59. // for deleting it.
  60. //
  61. // If header h is given, then the header of the file is copied into h.
  62. //
  63. IMFUTIL_EXPORT
  64. Image *
  65. loadImage
  66. (const std::string &fileName,
  67. Header &hdr);
  68. IMFUTIL_EXPORT
  69. Image *
  70. loadImage
  71. (const std::string &fileName);
  72. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
  73. #endif