tryiton 0.1.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -49,10 +49,10 @@ Image inputs accept a public URL or a base64 data URL (`data:image/png;base64,..
49
49
  | --------- | ---- | -------- | ----------- |
50
50
  | `modelImage` | string | Yes | URL or base64 data URL of the person. |
51
51
  | `garmentImage` | string | Yes | URL or base64 data URL of the garment or accessory. |
52
- | `category` | string | No | Item type: `auto`, `clothing`, `eyewear`, `footwear`, `headwear`, `jewelry`, `accessories`, or `others`. `auto` detects it for you. |
52
+ | `category` | string | No | Item type: `auto`, `clothing`, `eyewear`, `footwear`, `headwear`, `jewelry`, or `accessories`. `auto` detects it for you. |
53
53
  | `subcategory` | string | No | Required for `clothing` (`tops`, `bottoms`, `dresses`), `jewelry`, and `accessories`. |
54
54
 
55
- Additional clothing options (`mode`, `numSamples`, `outputFormat`, `seed`) are documented in the [API reference](https://docs.tryiton.now).
55
+ Additional options (`mode` and `moderationLevel` for clothing; `numSamples` 1–4 and `outputFormat` `png`/`jpeg` for every try-on, including hairstyle and tattoo) are documented in the [API reference](https://docs.tryiton.now).
56
56
 
57
57
  ## Other endpoints
58
58
 
@@ -60,8 +60,10 @@ Additional clothing options (`mode`, `numSamples`, `outputFormat`, `seed`) are d
60
60
  // Hairstyle try-on (see the HAIRCUTS export for all supported values)
61
61
  await client.tryOnHairstyle({ faceImage, haircut: "BuzzCut", hairColor: "ash blonde" });
62
62
 
63
- // Tattoo try-on
63
+ // Tattoo try-on — place it with free text...
64
64
  await client.tryOnTattoo({ bodyImage, designImage, placement: "on the right forearm, small" });
65
+ // ...or pin the exact spot with a region box (normalized 0–1, from the image's top-left)
66
+ await client.tryOnTattoo({ bodyImage, designImage, region: { x: 0.32, y: 0.18, w: 0.28, h: 0.34 } });
65
67
 
66
68
  // Poll a job manually, or check your credit balance
67
69
  const status = await client.getStatus(jobId); // { status, output, error }
package/dist/index.cjs CHANGED
@@ -111,9 +111,6 @@ var TryItOn = class {
111
111
  mode: params.mode,
112
112
  num_samples: params.numSamples,
113
113
  output_format: params.outputFormat,
114
- seed: params.seed,
115
- segmentation_free: params.segmentationFree,
116
- garment_photo_type: params.garmentPhotoType,
117
114
  moderation_level: params.moderationLevel
118
115
  };
119
116
  const res = await this.request("POST", "/tryon/clothes", body);
@@ -121,13 +118,26 @@ var TryItOn = class {
121
118
  }
122
119
  /** Restyle a person's hair. Returns the job id. */
123
120
  async tryOnHairstyle(params) {
124
- const body = { face_image: params.faceImage, haircut: params.haircut, hair_color: params.hairColor };
121
+ const body = {
122
+ face_image: params.faceImage,
123
+ haircut: params.haircut,
124
+ hair_color: params.hairColor,
125
+ num_samples: params.numSamples,
126
+ output_format: params.outputFormat
127
+ };
125
128
  const res = await this.request("POST", "/tryon/hairstyle", body);
126
129
  return res.jobId;
127
130
  }
128
131
  /** Ink a design onto skin. Returns the job id. */
129
132
  async tryOnTattoo(params) {
130
- const body = { body_image: params.bodyImage, design_image: params.designImage, placement: params.placement };
133
+ const body = {
134
+ body_image: params.bodyImage,
135
+ design_image: params.designImage,
136
+ placement: params.placement,
137
+ region: params.region,
138
+ num_samples: params.numSamples,
139
+ output_format: params.outputFormat
140
+ };
131
141
  const res = await this.request("POST", "/tryon/tattoo", body);
132
142
  return res.jobId;
133
143
  }
package/dist/index.d.cts CHANGED
@@ -34,8 +34,10 @@ interface Credits {
34
34
  purchased: number;
35
35
  reserved: number;
36
36
  }
37
- type Category = "auto" | "clothing" | "eyewear" | "footwear" | "headwear" | "jewelry" | "accessories" | "others";
37
+ type Category = "auto" | "clothing" | "eyewear" | "footwear" | "headwear" | "jewelry" | "accessories";
38
38
  type Mode = "performance" | "balanced" | "quality";
39
+ type OutputFormat = "png" | "jpeg";
40
+ type ModerationLevel = "conservative" | "permissive" | "none";
39
41
  interface TryOnClothesParams {
40
42
  /** URL or base64 data URL of the person. */
41
43
  modelImage: string;
@@ -47,18 +49,12 @@ interface TryOnClothesParams {
47
49
  subcategory?: string;
48
50
  /** Quality/speed trade-off (clothing only). */
49
51
  mode?: Mode;
50
- /** Number of output images, 1–4 (clothing only). Charged per image. */
52
+ /** Number of output images, 1–4. Charged per image. */
51
53
  numSamples?: number;
52
- /** "png" or "jpeg" (clothing only). */
53
- outputFormat?: "png" | "jpeg";
54
- /** Fixes randomness (clothing only). */
55
- seed?: number;
56
- /** Advanced (clothing only). */
57
- segmentationFree?: boolean;
58
- /** Advanced hint: "auto" | "model" | "flat-lay" (clothing only). */
59
- garmentPhotoType?: "auto" | "model" | "flat-lay";
60
- /** Advanced (clothing only). */
61
- moderationLevel?: string;
54
+ /** Output image format, "png" or "jpeg". Defaults to "png". */
55
+ outputFormat?: OutputFormat;
56
+ /** Content moderation strictness (clothing only). Defaults to "permissive". */
57
+ moderationLevel?: ModerationLevel;
62
58
  }
63
59
  interface TryOnHairstyleParams {
64
60
  /** URL or base64 data URL of the person's face. */
@@ -67,6 +63,24 @@ interface TryOnHairstyleParams {
67
63
  haircut: string;
68
64
  /** Optional free-text color, e.g. "ash blonde". Omit to keep current color. */
69
65
  hairColor?: string;
66
+ /** Number of output images, 1–4. Charged per image. */
67
+ numSamples?: number;
68
+ /** Output image format, "png" or "jpeg". Defaults to "png". */
69
+ outputFormat?: OutputFormat;
70
+ }
71
+ /**
72
+ * Rectangle on the body image, normalized 0–1 from its TOP-LEFT corner.
73
+ * Each side must be at least 0.06 of the image.
74
+ */
75
+ interface TattooRegion {
76
+ /** Left edge, 0–1. */
77
+ x: number;
78
+ /** Top edge, 0–1. */
79
+ y: number;
80
+ /** Width, 0–1. */
81
+ w: number;
82
+ /** Height, 0–1. */
83
+ h: number;
70
84
  }
71
85
  interface TryOnTattooParams {
72
86
  /** URL or base64 data URL — a close-up of bare skin. */
@@ -75,6 +89,16 @@ interface TryOnTattooParams {
75
89
  designImage: string;
76
90
  /** Optional free-text placement/size, max 140 chars. */
77
91
  placement?: string;
92
+ /**
93
+ * Optional exact spot for the ink, as a rectangle on the body image. Pins WHERE
94
+ * the tattoo goes, so `placement` then only describes size/style. Omit it and the
95
+ * placement text alone decides.
96
+ */
97
+ region?: TattooRegion;
98
+ /** Number of output images, 1–4. Charged per image. */
99
+ numSamples?: number;
100
+ /** Output image format, "png" or "jpeg". Defaults to "png". */
101
+ outputFormat?: OutputFormat;
78
102
  }
79
103
  interface WaitOptions {
80
104
  /** How often to poll, in ms. Default 2000. */
@@ -124,4 +148,4 @@ declare class TryItOn {
124
148
  private request;
125
149
  }
126
150
 
127
- export { type Category, type Credits, type FetchLike, HAIRCUTS, type JobError, type JobStatus, type Mode, type StatusResponse, TryItOn, TryItOnError, type TryItOnOptions, type TryOnClothesParams, type TryOnHairstyleParams, type TryOnTattooParams, type WaitOptions, TryItOn as default };
151
+ export { type Category, type Credits, type FetchLike, HAIRCUTS, type JobError, type JobStatus, type Mode, type ModerationLevel, type OutputFormat, type StatusResponse, type TattooRegion, TryItOn, TryItOnError, type TryItOnOptions, type TryOnClothesParams, type TryOnHairstyleParams, type TryOnTattooParams, type WaitOptions, TryItOn as default };
package/dist/index.d.ts CHANGED
@@ -34,8 +34,10 @@ interface Credits {
34
34
  purchased: number;
35
35
  reserved: number;
36
36
  }
37
- type Category = "auto" | "clothing" | "eyewear" | "footwear" | "headwear" | "jewelry" | "accessories" | "others";
37
+ type Category = "auto" | "clothing" | "eyewear" | "footwear" | "headwear" | "jewelry" | "accessories";
38
38
  type Mode = "performance" | "balanced" | "quality";
39
+ type OutputFormat = "png" | "jpeg";
40
+ type ModerationLevel = "conservative" | "permissive" | "none";
39
41
  interface TryOnClothesParams {
40
42
  /** URL or base64 data URL of the person. */
41
43
  modelImage: string;
@@ -47,18 +49,12 @@ interface TryOnClothesParams {
47
49
  subcategory?: string;
48
50
  /** Quality/speed trade-off (clothing only). */
49
51
  mode?: Mode;
50
- /** Number of output images, 1–4 (clothing only). Charged per image. */
52
+ /** Number of output images, 1–4. Charged per image. */
51
53
  numSamples?: number;
52
- /** "png" or "jpeg" (clothing only). */
53
- outputFormat?: "png" | "jpeg";
54
- /** Fixes randomness (clothing only). */
55
- seed?: number;
56
- /** Advanced (clothing only). */
57
- segmentationFree?: boolean;
58
- /** Advanced hint: "auto" | "model" | "flat-lay" (clothing only). */
59
- garmentPhotoType?: "auto" | "model" | "flat-lay";
60
- /** Advanced (clothing only). */
61
- moderationLevel?: string;
54
+ /** Output image format, "png" or "jpeg". Defaults to "png". */
55
+ outputFormat?: OutputFormat;
56
+ /** Content moderation strictness (clothing only). Defaults to "permissive". */
57
+ moderationLevel?: ModerationLevel;
62
58
  }
63
59
  interface TryOnHairstyleParams {
64
60
  /** URL or base64 data URL of the person's face. */
@@ -67,6 +63,24 @@ interface TryOnHairstyleParams {
67
63
  haircut: string;
68
64
  /** Optional free-text color, e.g. "ash blonde". Omit to keep current color. */
69
65
  hairColor?: string;
66
+ /** Number of output images, 1–4. Charged per image. */
67
+ numSamples?: number;
68
+ /** Output image format, "png" or "jpeg". Defaults to "png". */
69
+ outputFormat?: OutputFormat;
70
+ }
71
+ /**
72
+ * Rectangle on the body image, normalized 0–1 from its TOP-LEFT corner.
73
+ * Each side must be at least 0.06 of the image.
74
+ */
75
+ interface TattooRegion {
76
+ /** Left edge, 0–1. */
77
+ x: number;
78
+ /** Top edge, 0–1. */
79
+ y: number;
80
+ /** Width, 0–1. */
81
+ w: number;
82
+ /** Height, 0–1. */
83
+ h: number;
70
84
  }
71
85
  interface TryOnTattooParams {
72
86
  /** URL or base64 data URL — a close-up of bare skin. */
@@ -75,6 +89,16 @@ interface TryOnTattooParams {
75
89
  designImage: string;
76
90
  /** Optional free-text placement/size, max 140 chars. */
77
91
  placement?: string;
92
+ /**
93
+ * Optional exact spot for the ink, as a rectangle on the body image. Pins WHERE
94
+ * the tattoo goes, so `placement` then only describes size/style. Omit it and the
95
+ * placement text alone decides.
96
+ */
97
+ region?: TattooRegion;
98
+ /** Number of output images, 1–4. Charged per image. */
99
+ numSamples?: number;
100
+ /** Output image format, "png" or "jpeg". Defaults to "png". */
101
+ outputFormat?: OutputFormat;
78
102
  }
79
103
  interface WaitOptions {
80
104
  /** How often to poll, in ms. Default 2000. */
@@ -124,4 +148,4 @@ declare class TryItOn {
124
148
  private request;
125
149
  }
126
150
 
127
- export { type Category, type Credits, type FetchLike, HAIRCUTS, type JobError, type JobStatus, type Mode, type StatusResponse, TryItOn, TryItOnError, type TryItOnOptions, type TryOnClothesParams, type TryOnHairstyleParams, type TryOnTattooParams, type WaitOptions, TryItOn as default };
151
+ export { type Category, type Credits, type FetchLike, HAIRCUTS, type JobError, type JobStatus, type Mode, type ModerationLevel, type OutputFormat, type StatusResponse, type TattooRegion, TryItOn, TryItOnError, type TryItOnOptions, type TryOnClothesParams, type TryOnHairstyleParams, type TryOnTattooParams, type WaitOptions, TryItOn as default };
package/dist/index.js CHANGED
@@ -84,9 +84,6 @@ var TryItOn = class {
84
84
  mode: params.mode,
85
85
  num_samples: params.numSamples,
86
86
  output_format: params.outputFormat,
87
- seed: params.seed,
88
- segmentation_free: params.segmentationFree,
89
- garment_photo_type: params.garmentPhotoType,
90
87
  moderation_level: params.moderationLevel
91
88
  };
92
89
  const res = await this.request("POST", "/tryon/clothes", body);
@@ -94,13 +91,26 @@ var TryItOn = class {
94
91
  }
95
92
  /** Restyle a person's hair. Returns the job id. */
96
93
  async tryOnHairstyle(params) {
97
- const body = { face_image: params.faceImage, haircut: params.haircut, hair_color: params.hairColor };
94
+ const body = {
95
+ face_image: params.faceImage,
96
+ haircut: params.haircut,
97
+ hair_color: params.hairColor,
98
+ num_samples: params.numSamples,
99
+ output_format: params.outputFormat
100
+ };
98
101
  const res = await this.request("POST", "/tryon/hairstyle", body);
99
102
  return res.jobId;
100
103
  }
101
104
  /** Ink a design onto skin. Returns the job id. */
102
105
  async tryOnTattoo(params) {
103
- const body = { body_image: params.bodyImage, design_image: params.designImage, placement: params.placement };
106
+ const body = {
107
+ body_image: params.bodyImage,
108
+ design_image: params.designImage,
109
+ placement: params.placement,
110
+ region: params.region,
111
+ num_samples: params.numSamples,
112
+ output_format: params.outputFormat
113
+ };
104
114
  const res = await this.request("POST", "/tryon/tattoo", body);
105
115
  return res.jobId;
106
116
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tryiton",
3
- "version": "0.1.0",
3
+ "version": "1.1.0",
4
4
  "description": "Official JavaScript/TypeScript SDK for the TryItOn virtual try-on API.",
5
5
  "keywords": [
6
6
  "tryiton",
package/src/index.ts CHANGED
@@ -50,11 +50,14 @@ export type Category =
50
50
  | "footwear"
51
51
  | "headwear"
52
52
  | "jewelry"
53
- | "accessories"
54
- | "others";
53
+ | "accessories";
55
54
 
56
55
  export type Mode = "performance" | "balanced" | "quality";
57
56
 
57
+ export type OutputFormat = "png" | "jpeg";
58
+
59
+ export type ModerationLevel = "conservative" | "permissive" | "none";
60
+
58
61
  export interface TryOnClothesParams {
59
62
  /** URL or base64 data URL of the person. */
60
63
  modelImage: string;
@@ -66,18 +69,12 @@ export interface TryOnClothesParams {
66
69
  subcategory?: string;
67
70
  /** Quality/speed trade-off (clothing only). */
68
71
  mode?: Mode;
69
- /** Number of output images, 1–4 (clothing only). Charged per image. */
72
+ /** Number of output images, 1–4. Charged per image. */
70
73
  numSamples?: number;
71
- /** "png" or "jpeg" (clothing only). */
72
- outputFormat?: "png" | "jpeg";
73
- /** Fixes randomness (clothing only). */
74
- seed?: number;
75
- /** Advanced (clothing only). */
76
- segmentationFree?: boolean;
77
- /** Advanced hint: "auto" | "model" | "flat-lay" (clothing only). */
78
- garmentPhotoType?: "auto" | "model" | "flat-lay";
79
- /** Advanced (clothing only). */
80
- moderationLevel?: string;
74
+ /** Output image format, "png" or "jpeg". Defaults to "png". */
75
+ outputFormat?: OutputFormat;
76
+ /** Content moderation strictness (clothing only). Defaults to "permissive". */
77
+ moderationLevel?: ModerationLevel;
81
78
  }
82
79
 
83
80
  export interface TryOnHairstyleParams {
@@ -87,6 +84,25 @@ export interface TryOnHairstyleParams {
87
84
  haircut: string;
88
85
  /** Optional free-text color, e.g. "ash blonde". Omit to keep current color. */
89
86
  hairColor?: string;
87
+ /** Number of output images, 1–4. Charged per image. */
88
+ numSamples?: number;
89
+ /** Output image format, "png" or "jpeg". Defaults to "png". */
90
+ outputFormat?: OutputFormat;
91
+ }
92
+
93
+ /**
94
+ * Rectangle on the body image, normalized 0–1 from its TOP-LEFT corner.
95
+ * Each side must be at least 0.06 of the image.
96
+ */
97
+ export interface TattooRegion {
98
+ /** Left edge, 0–1. */
99
+ x: number;
100
+ /** Top edge, 0–1. */
101
+ y: number;
102
+ /** Width, 0–1. */
103
+ w: number;
104
+ /** Height, 0–1. */
105
+ h: number;
90
106
  }
91
107
 
92
108
  export interface TryOnTattooParams {
@@ -96,6 +112,16 @@ export interface TryOnTattooParams {
96
112
  designImage: string;
97
113
  /** Optional free-text placement/size, max 140 chars. */
98
114
  placement?: string;
115
+ /**
116
+ * Optional exact spot for the ink, as a rectangle on the body image. Pins WHERE
117
+ * the tattoo goes, so `placement` then only describes size/style. Omit it and the
118
+ * placement text alone decides.
119
+ */
120
+ region?: TattooRegion;
121
+ /** Number of output images, 1–4. Charged per image. */
122
+ numSamples?: number;
123
+ /** Output image format, "png" or "jpeg". Defaults to "png". */
124
+ outputFormat?: OutputFormat;
99
125
  }
100
126
 
101
127
  export interface WaitOptions {
@@ -182,9 +208,6 @@ export class TryItOn {
182
208
  mode: params.mode,
183
209
  num_samples: params.numSamples,
184
210
  output_format: params.outputFormat,
185
- seed: params.seed,
186
- segmentation_free: params.segmentationFree,
187
- garment_photo_type: params.garmentPhotoType,
188
211
  moderation_level: params.moderationLevel,
189
212
  };
190
213
  const res = await this.request<{ jobId: string }>("POST", "/tryon/clothes", body);
@@ -193,14 +216,27 @@ export class TryItOn {
193
216
 
194
217
  /** Restyle a person's hair. Returns the job id. */
195
218
  async tryOnHairstyle(params: TryOnHairstyleParams): Promise<string> {
196
- const body = { face_image: params.faceImage, haircut: params.haircut, hair_color: params.hairColor };
219
+ const body = {
220
+ face_image: params.faceImage,
221
+ haircut: params.haircut,
222
+ hair_color: params.hairColor,
223
+ num_samples: params.numSamples,
224
+ output_format: params.outputFormat,
225
+ };
197
226
  const res = await this.request<{ jobId: string }>("POST", "/tryon/hairstyle", body);
198
227
  return res.jobId;
199
228
  }
200
229
 
201
230
  /** Ink a design onto skin. Returns the job id. */
202
231
  async tryOnTattoo(params: TryOnTattooParams): Promise<string> {
203
- const body = { body_image: params.bodyImage, design_image: params.designImage, placement: params.placement };
232
+ const body = {
233
+ body_image: params.bodyImage,
234
+ design_image: params.designImage,
235
+ placement: params.placement,
236
+ region: params.region,
237
+ num_samples: params.numSamples,
238
+ output_format: params.outputFormat,
239
+ };
204
240
  const res = await this.request<{ jobId: string }>("POST", "/tryon/tattoo", body);
205
241
  return res.jobId;
206
242
  }