metadata.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // Copyright 2013 Lovell Fuller and others.
  2. // SPDX-License-Identifier: Apache-2.0
  3. #ifndef SRC_METADATA_H_
  4. #define SRC_METADATA_H_
  5. #include <string>
  6. #include <napi.h>
  7. #include "./common.h"
  8. struct MetadataBaton {
  9. // Input
  10. sharp::InputDescriptor *input;
  11. // Output
  12. std::string format;
  13. int width;
  14. int height;
  15. std::string space;
  16. int channels;
  17. std::string depth;
  18. int density;
  19. std::string chromaSubsampling;
  20. bool isProgressive;
  21. int paletteBitDepth;
  22. int pages;
  23. int pageHeight;
  24. int loop;
  25. std::vector<int> delay;
  26. int pagePrimary;
  27. std::string compression;
  28. std::string resolutionUnit;
  29. std::string formatMagick;
  30. std::vector<std::pair<int, int>> levels;
  31. int subifds;
  32. std::vector<double> background;
  33. bool hasProfile;
  34. bool hasAlpha;
  35. int orientation;
  36. char *exif;
  37. size_t exifLength;
  38. char *icc;
  39. size_t iccLength;
  40. char *iptc;
  41. size_t iptcLength;
  42. char *xmp;
  43. size_t xmpLength;
  44. char *tifftagPhotoshop;
  45. size_t tifftagPhotoshopLength;
  46. std::string err;
  47. MetadataBaton():
  48. input(nullptr),
  49. width(0),
  50. height(0),
  51. channels(0),
  52. density(0),
  53. isProgressive(false),
  54. paletteBitDepth(0),
  55. pages(0),
  56. pageHeight(0),
  57. loop(-1),
  58. pagePrimary(-1),
  59. subifds(0),
  60. hasProfile(false),
  61. hasAlpha(false),
  62. orientation(0),
  63. exif(nullptr),
  64. exifLength(0),
  65. icc(nullptr),
  66. iccLength(0),
  67. iptc(nullptr),
  68. iptcLength(0),
  69. xmp(nullptr),
  70. xmpLength(0),
  71. tifftagPhotoshop(nullptr),
  72. tifftagPhotoshopLength(0) {}
  73. };
  74. Napi::Value metadata(const Napi::CallbackInfo& info);
  75. #endif // SRC_METADATA_H_