Skip to content

Commit 08b4270

Browse files
authored
Merge pull request #142 from imagekit-developer/update-overlay-syntax
update overlay syntax
2 parents af9245c + 92efa16 commit 08b4270

File tree

1 file changed

+55
-28
lines changed

1 file changed

+55
-28
lines changed

README.md

Lines changed: 55 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,61 @@ transformation = [
278278

279279
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.
280280

281+
### Adding overlays
282+
283+
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.
284+
285+
**Text as overlays**
286+
287+
You can add any text string over a base video or image using a text layer (l-text).
288+
289+
For example:
290+
291+
```js
292+
<IKImage
293+
path="/default-image.jpg"
294+
transformation={[{ "width": 400, "height": 300 },{ "raw": "l-text,i-Imagekit,fs-50,l-end" }]}
295+
/>
296+
```
297+
**Sample Result URL**
298+
```
299+
https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400,l-text,i-Imagekit,fs-50,l-end/default-image.jpg
300+
```
301+
302+
**Image as overlays**
303+
304+
You can add an image over a base video or image using an image layer (l-image).
305+
306+
For example:
307+
308+
```js
309+
<IKImage
310+
path="/default-image.jpg"
311+
transformation={[{ "width": 400, "height": 300 },{ "raw": "l-image,i-default-image.jpg,w-100,b-10_CDDC39,l-end" }]}
312+
/>
313+
```
314+
**Sample Result URL**
315+
```
316+
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
317+
```
318+
319+
**Solid color blocks as overlays**
320+
321+
You can add solid color blocks over a base video or image using an image layer (l-image).
322+
323+
For example:
324+
325+
```js
326+
<IKVideo
327+
path="/img/sample-video.mp4"
328+
transformation={[{ "width": 400, "height": 300 },{ "raw": "l-image,i-ik_canvas,bg-FF0000,w-300,h-100,l-end" }]}
329+
/>
330+
```
331+
**Sample Result URL**
332+
```
333+
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
334+
```
335+
281336
### List of supported transformations
282337
<details>
283338
<summary>Expand</summary>
@@ -300,34 +355,6 @@ See the complete list of transformations supported in ImageKit [here](https://do
300355
| rotation | rt |
301356
| blur | bl |
302357
| named | n |
303-
| overlayX | ox |
304-
| overlayY | oy |
305-
| overlayFocus | ofo |
306-
| overlayHeight | oh |
307-
| overlayWidth | ow |
308-
| overlayImage | oi |
309-
| overlayImageTrim | oit |
310-
| overlayImageAspectRatio | oiar |
311-
| overlayImageBackground | oibg |
312-
| overlayImageBorder | oib |
313-
| overlayImageDPR | oidpr |
314-
| overlayImageQuality | oiq |
315-
| overlayImageCropping | oic |
316-
| overlayImageTrim | oit |
317-
| overlayText | ot |
318-
| overlayTextFontSize | ots |
319-
| overlayTextFontFamily | otf |
320-
| overlayTextColor | otc |
321-
| overlayTextTransparency | oa |
322-
| overlayAlpha | oa |
323-
| overlayTextTypography | ott |
324-
| overlayBackground | obg |
325-
| overlayTextEncoded | ote |
326-
| overlayTextWidth | otw |
327-
| overlayTextBackground | otbg |
328-
| overlayTextPadding | otp |
329-
| overlayTextInnerAlignment | otia |
330-
| overlayRadius | or |
331358
| progressive | pr |
332359
| lossless | lo |
333360
| trim | t |

0 commit comments

Comments
 (0)