Skip to content

Commit c5c093e

Browse files
ANKUR DWIVEDIANKUR DWIVEDI
authored andcommitted
update readme.md
1 parent 329f02b commit c5c093e

1 file changed

Lines changed: 63 additions & 2 deletions

File tree

README.md

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,20 +200,81 @@ params := ikurl.UrlParam{
200200
}
201201
```
202202

203-
**3. Adding overlays to images**
203+
**3. Adding overlays**
204+
205+
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.
206+
207+
**Text as overlays**
208+
209+
You can add any text string over a base video or image using a text layer (l-text).
210+
211+
For example:
212+
213+
```go
214+
params := ikurl.UrlParam{
215+
Path: "default-image.jpg",
216+
UrlEndpoint: "https://ik.imagekit.io/demo-id/",
217+
Transformations: []map[string]any{
218+
{
219+
"height": 300,
220+
"width": 400,
221+
"raw": "l-text,i-Imagekit,fs-50,l-end"
222+
},
223+
},
224+
}
225+
```
226+
**Sample Result URL**
227+
```
228+
https://ik.imagekit.io/demo-id/default-image.jpg?tr=h-300,w-400,l-text,i-Imagekit,fs-50,l-end
229+
```
230+
231+
**Image as overlays**
232+
233+
You can add an image over a base video or image using an image layer (l-image).
234+
235+
For example:
204236

205-
ImageKit.io allows overlaying [text](https://docs.imagekit.io/features/image-transformations/overlay-using-layers#add-text-over-image) or [image](https://docs.imagekit.io/features/image-transformations/overlay-using-layers#add-images-over-image) over other images and videos for watermarking or creating dynamic assets using custom text.
206237
```go
207238
params := ikurl.UrlParam{
208239
Path: "default-image.jpg",
209240
UrlEndpoint: "https://ik.imagekit.io/demo-id/",
210241
Transformations: []map[string]any{
211242
{
243+
"height": 300,
244+
"width": 400,
212245
"raw": "l-image,i-default-image.jpg,w-100,b-10_CDDC39,l-end"
213246
},
214247
},
215248
}
216249
```
250+
**Sample Result URL**
251+
```
252+
https://ik.imagekit.io/demo-id/default-image.jpg?tr=h-300,w-400,l-image,i-default-image.jpg,w-100,b-10_CDDC39,l-end
253+
```
254+
255+
**Solid color blocks as overlays**
256+
257+
You can add solid color blocks over a base video or image using an image layer (l-image).
258+
259+
For example:
260+
261+
```go
262+
params := ikurl.UrlParam{
263+
Path: "img/sample-video.mp4",
264+
UrlEndpoint: "https://ik.imagekit.io/demo-id/",
265+
Transformations: []map[string]any{
266+
{
267+
"height": 300,
268+
"width": 400,
269+
"raw": "l-image,i-ik_canvas,bg-FF0000,w-300,h-100,l-end"
270+
},
271+
},
272+
}
273+
```
274+
**Sample Result URL**
275+
```
276+
https://ik.imagekit.io/demo-id/img/sample-video.mp4?tr=h-300,w-400,l-image,i-ik_canvas,bg-FF0000,w-300,h-100,l-end
277+
```
217278
#### List of supported transformations
218279

219280
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.

0 commit comments

Comments
 (0)