Skip to content

Commit d94e13c

Browse files
authored
Merge pull request #97 from imagekit-developer/update-overlay-syntax
update readme.md
2 parents b76274e + 3f1a372 commit d94e13c

File tree

1 file changed

+56
-6
lines changed

1 file changed

+56
-6
lines changed

README.md

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,6 @@ To use the SDK, you need to provide it with a few configuration parameters. The
138138
}]'
139139
></ik-image>
140140

141-
// Renders an image with text overlaid.
142-
<ik-image
143-
path="/default-image.jpg"
144-
[transformation]='[{ "width": 300, "height": 300 },{ "raw": "l-text,i-Imagekit,rt-90,co-0651D5,fs-50,l-end" }]'>
145-
</ik-image>
146-
147141
// Lazy loading
148142
<ik-image path="/default-image.jpg" loading="lazy"></ik-image>
149143

@@ -257,6 +251,62 @@ Sample usage of ik-image component:
257251

258252
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 in the URL.
259253

254+
### Adding overlays
255+
256+
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.
257+
258+
**Text as overlays**
259+
260+
You can add any text string over a base video or image using a text layer (l-text).
261+
262+
For example:
263+
264+
```js
265+
<ik-image
266+
path="/default-image.jpg"
267+
[transformation]='[{ "width": 400, "height": 300, "raw": "l-text,i-Imagekit,fs-50,l-end" }]'>
268+
</ik-image>
269+
```
270+
**Sample Result URL**
271+
```
272+
https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400,l-text,i-Imagekit,fs-50,l-end/default-image.jpg
273+
```
274+
275+
**Image as overlays**
276+
277+
You can add an image over a base video or image using an image layer (l-image).
278+
279+
For example:
280+
281+
```js
282+
<ik-image
283+
path="/default-image.jpg"
284+
[transformation]='[{ "width": 400, "height": 300, "raw": "l-image,i-default-image.jpg,w-100,b-10_CDDC39,l-end" }]'>
285+
</ik-image>
286+
```
287+
**Sample Result URL**
288+
```
289+
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
290+
```
291+
292+
**Solid color blocks as overlays**
293+
294+
You can add solid color blocks over a base video or image using an image layer (l-image).
295+
296+
For example:
297+
298+
```js
299+
<ik-video
300+
path="/img/sample-video.mp4"
301+
[transformation]='[{ "width": 400, "height": 300, "raw": "l-image,i-ik_canvas,bg-FF0000,w-300,h-100,l-end" }]'>
302+
</ik-video>
303+
```
304+
**Sample Result URL**
305+
```
306+
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
307+
```
308+
309+
260310
#### List of supported transformations
261311

262312
<details>

0 commit comments

Comments
 (0)