tryiton 1.0.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,7 +49,7 @@ 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
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).
@@ -60,8 +60,10 @@ Additional options (`mode` and `moderationLevel` for clothing; `numSamples` 1–
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
@@ -134,6 +134,7 @@ var TryItOn = class {
134
134
  body_image: params.bodyImage,
135
135
  design_image: params.designImage,
136
136
  placement: params.placement,
137
+ region: params.region,
137
138
  num_samples: params.numSamples,
138
139
  output_format: params.outputFormat
139
140
  };
package/dist/index.d.cts CHANGED
@@ -34,7 +34,7 @@ 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
39
  type OutputFormat = "png" | "jpeg";
40
40
  type ModerationLevel = "conservative" | "permissive" | "none";
@@ -68,6 +68,20 @@ interface TryOnHairstyleParams {
68
68
  /** Output image format, "png" or "jpeg". Defaults to "png". */
69
69
  outputFormat?: OutputFormat;
70
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;
84
+ }
71
85
  interface TryOnTattooParams {
72
86
  /** URL or base64 data URL — a close-up of bare skin. */
73
87
  bodyImage: string;
@@ -75,6 +89,12 @@ 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;
78
98
  /** Number of output images, 1–4. Charged per image. */
79
99
  numSamples?: number;
80
100
  /** Output image format, "png" or "jpeg". Defaults to "png". */
@@ -128,4 +148,4 @@ declare class TryItOn {
128
148
  private request;
129
149
  }
130
150
 
131
- export { type Category, type Credits, type FetchLike, HAIRCUTS, type JobError, type JobStatus, type Mode, type ModerationLevel, type OutputFormat, 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,7 +34,7 @@ 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
39
  type OutputFormat = "png" | "jpeg";
40
40
  type ModerationLevel = "conservative" | "permissive" | "none";
@@ -68,6 +68,20 @@ interface TryOnHairstyleParams {
68
68
  /** Output image format, "png" or "jpeg". Defaults to "png". */
69
69
  outputFormat?: OutputFormat;
70
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;
84
+ }
71
85
  interface TryOnTattooParams {
72
86
  /** URL or base64 data URL — a close-up of bare skin. */
73
87
  bodyImage: string;
@@ -75,6 +89,12 @@ 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;
78
98
  /** Number of output images, 1–4. Charged per image. */
79
99
  numSamples?: number;
80
100
  /** Output image format, "png" or "jpeg". Defaults to "png". */
@@ -128,4 +148,4 @@ declare class TryItOn {
128
148
  private request;
129
149
  }
130
150
 
131
- export { type Category, type Credits, type FetchLike, HAIRCUTS, type JobError, type JobStatus, type Mode, type ModerationLevel, type OutputFormat, 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
@@ -107,6 +107,7 @@ var TryItOn = class {
107
107
  body_image: params.bodyImage,
108
108
  design_image: params.designImage,
109
109
  placement: params.placement,
110
+ region: params.region,
110
111
  num_samples: params.numSamples,
111
112
  output_format: params.outputFormat
112
113
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tryiton",
3
- "version": "1.0.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,8 +50,7 @@ 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
 
@@ -91,6 +90,21 @@ export interface TryOnHairstyleParams {
91
90
  outputFormat?: OutputFormat;
92
91
  }
93
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;
106
+ }
107
+
94
108
  export interface TryOnTattooParams {
95
109
  /** URL or base64 data URL — a close-up of bare skin. */
96
110
  bodyImage: string;
@@ -98,6 +112,12 @@ export interface TryOnTattooParams {
98
112
  designImage: string;
99
113
  /** Optional free-text placement/size, max 140 chars. */
100
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;
101
121
  /** Number of output images, 1–4. Charged per image. */
102
122
  numSamples?: number;
103
123
  /** Output image format, "png" or "jpeg". Defaults to "png". */
@@ -213,6 +233,7 @@ export class TryItOn {
213
233
  body_image: params.bodyImage,
214
234
  design_image: params.designImage,
215
235
  placement: params.placement,
236
+ region: params.region,
216
237
  num_samples: params.numSamples,
217
238
  output_format: params.outputFormat,
218
239
  };