metadata.h 1.7 KB

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