Skip to content

Commit 1c2eed5

Browse files
authored
Merge pull request #83 from imagekit-developer/update-overlay-syntax
update readme.md
2 parents 020cd51 + 1914d41 commit 1c2eed5

File tree

1 file changed

+68
-36
lines changed

1 file changed

+68
-36
lines changed

README.md

Lines changed: 68 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -193,20 +193,80 @@ var imageURL = imagekit.url({
193193
https://ik.imagekit.io/your_imagekit_id/endpoint/default-image.jpg?tr=f-jpg%2Cpr-true%2Ce-sharpen%2Ce-contrast-1
194194
```
195195

196+
**3. Adding overlays**
197+
198+
ImageKit.io enables you to apply overlays to [images](https://docs.imagekit.io/features/image-transformations/overlay-using-layers) and [videos](https://docs.imagekit.io/features/video-transformation/overlay) using the raw parameter with the concept of [layers](https://docs.imagekit.io/features/image-transformations/overlay-using-layers#layers). The raw parameter facilitates incorporating transformations directly in the URL. A layer is a distinct type of transformation that allows you to define an asset to serve as an overlay, along with its positioning and additional transformations.
199+
200+
**Text as overlays**
201+
202+
You can add any text string over a base video or image using a text layer (l-text).
203+
204+
For example:
205+
206+
```js
207+
var imageURL = imagekit.url({
208+
src: "https://ik.imagekit.io/your_imagekit_id/default-image.jpg",
209+
transformation: [{
210+
"width": 400,
211+
"height": 300
212+
"raw": "l-text,i-Imagekit,fs-50,l-end"
213+
}]
214+
});
215+
```
216+
**Sample Result URL**
217+
```
218+
https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400,l-text,i-Imagekit,fs-50,l-end/default-image.jpg
219+
```
220+
221+
**Image as overlays**
222+
223+
You can add an image over a base video or image using an image layer (l-image).
224+
225+
For example:
226+
227+
```js
228+
var imageURL = imagekit.url({
229+
src: "https://ik.imagekit.io/your_imagekit_id/default-image.jpg",
230+
transformation: [{
231+
"width": 400,
232+
"height": 300
233+
"raw": "l-image,i-default-image.jpg,w-100,b-10_CDDC39,l-end"
234+
}]
235+
});
236+
```
237+
**Sample Result URL**
238+
```
239+
https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400,l-image,i-default-image.jpg,w-100,b-10_CDDC39,l-end/default-image.jpg
240+
```
241+
242+
**Solid color blocks as overlays**
243+
244+
You can add solid color blocks over a base video or image using an image layer (l-image).
245+
246+
For example:
247+
248+
```js
249+
var imageURL = imagekit.url({
250+
src: "https://ik.imagekit.io/your_imagekit_id/img/sample-video.mp4",
251+
transformation: [{
252+
"width": 400,
253+
"height": 300
254+
"raw": "l-image,i-ik_canvas,bg-FF0000,w-300,h-100,l-end"
255+
}]
256+
});
257+
```
258+
**Sample Result URL**
259+
```
260+
https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400,l-image,i-ik_canvas,bg-FF0000,w-300,h-100,l-end/img/sample-video.mp4
261+
```
262+
263+
196264
#### List of supported transformations
197265

198266
See the complete list of transformations supported in ImageKit [here](https://docs.imagekit.io/features/image-transformations). The SDK gives a name to each transformation parameter e.g. `height` for `h` and `width` for `w` parameter. It makes your code more readable. If the property does not match any of the following supported options, it is added as it is.
199267

200268
If you want to generate transformations in your application and add them to the URL as it is, use the `raw` parameter.
201269

202-
<br/>
203-
204-
> #### Deprecation notice
205-
> The list below mentions the old overlay syntax parameters such as `oi`, `ot`, `obg`, and more. These parameters will be deprecated on 31st Oct 2023 and will start returning errors when used in URLs. Please migrate to the new Layers syntax that supports overlay nesting, provides better positional control, and allows more transformations at the layer level. You can start with [examples](https://docs.imagekit.io/features/image-transformations/overlay-using-layers#examples) to learn quickly.
206-
> If you create overlay transformations using the JavaScript SDK, you can migrate to the new Layers syntax using the `raw` transformation parameter, as given in the example below.
207-
> `transformation : [{ "width" : 300, "height" : 300 },{ "raw": "l-image,i-logo.png,w-10,rt-90,l-end" }]`
208-
<br/>
209-
210270
| Supported Transformation Name | Translates to parameter |
211271
|-------------------------------|-------------------------|
212272
| height | h |
@@ -225,34 +285,6 @@ If you want to generate transformations in your application and add them to the
225285
| rotation | rt |
226286
| blur | bl |
227287
| named | n |
228-
| overlayX | ox |
229-
| overlayY | oy |
230-
| overlayFocus | ofo |
231-
| overlayHeight | oh |
232-
| overlayWidth | ow |
233-
| overlayImage | oi |
234-
| overlayImageTrim | oit |
235-
| overlayImageAspectRatio | oiar |
236-
| overlayImageBackground | oibg |
237-
| overlayImageBorder | oib |
238-
| overlayImageDPR | oidpr |
239-
| overlayImageQuality | oiq |
240-
| overlayImageCropping | oic |
241-
| overlayImageTrim | oit |
242-
| overlayText | ot |
243-
| overlayTextFontSize | ots |
244-
| overlayTextFontFamily | otf |
245-
| overlayTextColor | otc |
246-
| overlayTextTransparency | oa |
247-
| overlayAlpha | oa |
248-
| overlayTextTypography | ott |
249-
| overlayBackground | obg |
250-
| overlayTextEncoded | ote |
251-
| overlayTextWidth | otw |
252-
| overlayTextBackground | otbg |
253-
| overlayTextPadding | otp |
254-
| overlayTextInnerAlignment | otia |
255-
| overlayRadius | or |
256288
| progressive | pr |
257289
| lossless | lo |
258290
| trim | t |

0 commit comments

Comments
 (0)