Skip to content

Commit 81ad0f4

Browse files
authored
Merge pull request #102 from imagekit-developer/update-overlay-syntax
update readme.md
2 parents a2fbf18 + 409aabb commit 81ad0f4

File tree

1 file changed

+58
-36
lines changed

1 file changed

+58
-36
lines changed

README.md

Lines changed: 58 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ In order to use the SDK, you need to provide it with a few configuration paramet
236236

237237
```js
238238
<IKContext
239-
:publicKey="your_url_endpoint"
240-
:urlEndpoint="your_public_api_key"
239+
:publicKey="your_public_api_key"
240+
:urlEndpoint="your_url_endpoint"
241241
:authenticator={()=>Promise}
242242
// This promise resolves with an object containing the necessary security parameters i.e `signature`, `token`, and `expire`.
243243
>
@@ -318,14 +318,64 @@ transformation = [
318318
319319
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.
320320
321-
<br/>
321+
### Adding overlays
322322
323-
> #### Deprecation notice
324-
> 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.
325-
> 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.
326-
> `transformation = [{ "width": 300, "height": 300 },{ "raw": "l-image,i-logo.png,w-10,rt-90,l-end" }]`
323+
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.
324+
325+
**Text as overlays**
326+
327+
You can add any text string over a base video or image using a text layer (l-text).
328+
329+
For example:
330+
331+
```js
332+
<IKImage
333+
path="/default-image.jpg"
334+
urlEndpoint="https://ik.imagekit.io/your_imagekit_id/endpoint/"
335+
:transformation="[{ "width": 400, "height": 300, "raw": "l-text,i-Imagekit,fs-50,l-end" }]"
336+
/>
337+
```
338+
**Sample Result URL**
339+
```
340+
https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400,l-text,i-Imagekit,fs-50,l-end/default-image.jpg
341+
```
342+
343+
**Image as overlays**
344+
345+
You can add an image over a base video or image using an image layer (l-image).
346+
347+
For example:
348+
349+
```js
350+
<IKImage
351+
path="/default-image.jpg"
352+
urlEndpoint="https://ik.imagekit.io/your_imagekit_id/endpoint/"
353+
:transformation="[{ "width": 400, "height": 300, "raw": "l-image,i-default-image.jpg,w-100,b-10_CDDC39,l-end" }]"
354+
/>
355+
```
356+
**Sample Result URL**
357+
```
358+
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
359+
```
360+
361+
**Solid color blocks as overlays**
362+
363+
You can add solid color blocks over a base video or image using an image layer (l-image).
364+
365+
For example:
366+
367+
```js
368+
<IKVideo
369+
path="/img/sample-video.mp4"
370+
urlEndpoint="https://ik.imagekit.io/your_imagekit_id/endpoint/"
371+
:transformation="[{ "width": 400, "height": 300, "raw": "l-image,i-ik_canvas,bg-FF0000,w-300,h-100,l-end" }]"
372+
/>
373+
```
374+
**Sample Result URL**
375+
```
376+
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
377+
```
327378
328-
<br/>
329379
330380
### List of supported transformations
331381
<details>
@@ -349,34 +399,6 @@ See the complete list of transformations supported in ImageKit [here](https://do
349399
| rotation | rt |
350400
| blur | bl |
351401
| named | n |
352-
| overlayX | ox |
353-
| overlayY | oy |
354-
| overlayFocus | ofo |
355-
| overlayHeight | oh |
356-
| overlayWidth | ow |
357-
| overlayImage | oi |
358-
| overlayImageTrim | oit |
359-
| overlayImageAspectRatio | oiar |
360-
| overlayImageBackground | oibg |
361-
| overlayImageBorder | oib |
362-
| overlayImageDPR | oidpr |
363-
| overlayImageQuality | oiq |
364-
| overlayImageCropping | oic |
365-
| overlayImageTrim | oit |
366-
| overlayText | ot |
367-
| overlayTextFontSize | ots |
368-
| overlayTextFontFamily | otf |
369-
| overlayTextColor | otc |
370-
| overlayTextTransparency | oa |
371-
| overlayAlpha | oa |
372-
| overlayTextTypography | ott |
373-
| overlayBackground | obg |
374-
| overlayTextEncoded | ote |
375-
| overlayTextWidth | otw |
376-
| overlayTextBackground | otbg |
377-
| overlayTextPadding | otp |
378-
| overlayTextInnerAlignment | otia |
379-
| overlayRadius | or |
380402
| progressive | pr |
381403
| lossless | lo |
382404
| trim | t |

0 commit comments

Comments
 (0)