images_service.proto 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. syntax = "proto2";
  2. option go_package = "image";
  3. package appengine;
  4. message ImagesServiceError {
  5. enum ErrorCode {
  6. UNSPECIFIED_ERROR = 1;
  7. BAD_TRANSFORM_DATA = 2;
  8. NOT_IMAGE = 3;
  9. BAD_IMAGE_DATA = 4;
  10. IMAGE_TOO_LARGE = 5;
  11. INVALID_BLOB_KEY = 6;
  12. ACCESS_DENIED = 7;
  13. OBJECT_NOT_FOUND = 8;
  14. }
  15. }
  16. message ImagesServiceTransform {
  17. enum Type {
  18. RESIZE = 1;
  19. ROTATE = 2;
  20. HORIZONTAL_FLIP = 3;
  21. VERTICAL_FLIP = 4;
  22. CROP = 5;
  23. IM_FEELING_LUCKY = 6;
  24. }
  25. }
  26. message Transform {
  27. optional int32 width = 1;
  28. optional int32 height = 2;
  29. optional bool crop_to_fit = 11 [default = false];
  30. optional float crop_offset_x = 12 [default = 0.5];
  31. optional float crop_offset_y = 13 [default = 0.5];
  32. optional int32 rotate = 3 [default = 0];
  33. optional bool horizontal_flip = 4 [default = false];
  34. optional bool vertical_flip = 5 [default = false];
  35. optional float crop_left_x = 6 [default = 0.0];
  36. optional float crop_top_y = 7 [default = 0.0];
  37. optional float crop_right_x = 8 [default = 1.0];
  38. optional float crop_bottom_y = 9 [default = 1.0];
  39. optional bool autolevels = 10 [default = false];
  40. optional bool allow_stretch = 14 [default = false];
  41. }
  42. message ImageData {
  43. required bytes content = 1 [ctype=CORD];
  44. optional string blob_key = 2;
  45. optional int32 width = 3;
  46. optional int32 height = 4;
  47. }
  48. message InputSettings {
  49. enum ORIENTATION_CORRECTION_TYPE {
  50. UNCHANGED_ORIENTATION = 0;
  51. CORRECT_ORIENTATION = 1;
  52. }
  53. optional ORIENTATION_CORRECTION_TYPE correct_exif_orientation = 1
  54. [default=UNCHANGED_ORIENTATION];
  55. optional bool parse_metadata = 2 [default=false];
  56. optional int32 transparent_substitution_rgb = 3;
  57. }
  58. message OutputSettings {
  59. enum MIME_TYPE {
  60. PNG = 0;
  61. JPEG = 1;
  62. WEBP = 2;
  63. }
  64. optional MIME_TYPE mime_type = 1 [default=PNG];
  65. optional int32 quality = 2;
  66. }
  67. message ImagesTransformRequest {
  68. required ImageData image = 1;
  69. repeated Transform transform = 2;
  70. required OutputSettings output = 3;
  71. optional InputSettings input = 4;
  72. }
  73. message ImagesTransformResponse {
  74. required ImageData image = 1;
  75. optional string source_metadata = 2;
  76. }
  77. message CompositeImageOptions {
  78. required int32 source_index = 1;
  79. required int32 x_offset = 2;
  80. required int32 y_offset = 3;
  81. required float opacity = 4;
  82. enum ANCHOR {
  83. TOP_LEFT = 0;
  84. TOP = 1;
  85. TOP_RIGHT = 2;
  86. LEFT = 3;
  87. CENTER = 4;
  88. RIGHT = 5;
  89. BOTTOM_LEFT = 6;
  90. BOTTOM = 7;
  91. BOTTOM_RIGHT = 8;
  92. }
  93. required ANCHOR anchor = 5;
  94. }
  95. message ImagesCanvas {
  96. required int32 width = 1;
  97. required int32 height = 2;
  98. required OutputSettings output = 3;
  99. optional int32 color = 4 [default=-1];
  100. }
  101. message ImagesCompositeRequest {
  102. repeated ImageData image = 1;
  103. repeated CompositeImageOptions options = 2;
  104. required ImagesCanvas canvas = 3;
  105. }
  106. message ImagesCompositeResponse {
  107. required ImageData image = 1;
  108. }
  109. message ImagesHistogramRequest {
  110. required ImageData image = 1;
  111. }
  112. message ImagesHistogram {
  113. repeated int32 red = 1;
  114. repeated int32 green = 2;
  115. repeated int32 blue = 3;
  116. }
  117. message ImagesHistogramResponse {
  118. required ImagesHistogram histogram = 1;
  119. }
  120. message ImagesGetUrlBaseRequest {
  121. required string blob_key = 1;
  122. optional bool create_secure_url = 2 [default = false];
  123. }
  124. message ImagesGetUrlBaseResponse {
  125. required string url = 1;
  126. }
  127. message ImagesDeleteUrlBaseRequest {
  128. required string blob_key = 1;
  129. }
  130. message ImagesDeleteUrlBaseResponse {
  131. }