Skip to content

Commit 07038ee

Browse files
authored
Merge pull request #59 from imagekit-developer/update-overlay-syntax
Update overlay syntax
2 parents 60d2439 + a2c505d commit 07038ee

File tree

1 file changed

+70
-28
lines changed

1 file changed

+70
-28
lines changed

README.md

Lines changed: 70 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,76 @@ image_url = imagekit.url({
282282
https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400/default-image.jpg?v=123&ik-t=1567358667&ik-s=f2c7cdacbe7707b71a83d49cf1c6110e3d701054
283283
```
284284

285+
**4. Adding overlays**
286+
287+
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.
288+
289+
**Text as overlays**
290+
291+
You can add any text string over a base video or image using a text layer (l-text).
292+
293+
For example:
294+
295+
```ruby
296+
image_url = imagekit.url({
297+
path: "/default-image",
298+
url_endpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/",
299+
transformation: [{
300+
height: "300",
301+
width: "400",
302+
raw: "l-text,i-Imagekit,fs-50,l-end"
303+
}],
304+
})
305+
```
306+
**Sample Result URL**
307+
```
308+
https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400,l-text,i-Imagekit,fs-50,l-end/default-image.jpg
309+
```
310+
311+
**Image as overlays**
312+
313+
You can add an image over a base video or image using an image layer (l-image).
314+
315+
For example:
316+
317+
```ruby
318+
image_url = imagekit.url({
319+
path: "/default-image",
320+
url_endpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/",
321+
transformation: [{
322+
height: "300",
323+
width: "400",
324+
raw: "l-image,i-default-image.jpg,w-100,b-10_CDDC39,l-end"
325+
}],
326+
})
327+
```
328+
**Sample Result URL**
329+
```
330+
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
331+
```
332+
333+
**Solid color blocks as overlays**
334+
335+
You can add solid color blocks over a base video or image using an image layer (l-image).
336+
337+
For example:
338+
339+
```ruby
340+
image_url = imagekit.url({
341+
path: "/img/sample-video",
342+
url_endpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/",
343+
transformation: [{
344+
height: "300",
345+
width: "400",
346+
raw: "l-image,i-ik_canvas,bg-FF0000,w-300,h-100,l-end"
347+
}],
348+
})
349+
```
350+
**Sample Result URL**
351+
```
352+
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
353+
```
354+
285355
**List of transformations**
286356

287357
The complete list of transformations supported and their usage in ImageKit can be found [here](https://docs.imagekit.io/features/image-transformations/resize-crop-and-other-transformations). The SDK gives a name to each transformation parameter, making the code simpler, making the code simpler, and readable.
@@ -308,34 +378,6 @@ If you want to generate transformations in your application and add them to the
308378
| rotation | rt |
309379
| blur | bl |
310380
| named | n |
311-
| overlayX | ox |
312-
| overlayY | oy |
313-
| overlayFocus | ofo |
314-
| overlayHeight | oh |
315-
| overlayWidth | ow |
316-
| overlayImage | oi |
317-
| overlayImageTrim | oit |
318-
| overlayImageAspectRatio | oiar |
319-
| overlayImageBackground | oibg |
320-
| overlayImageBorder | oib |
321-
| overlayImageDPR | oidpr |
322-
| overlayImageQuality | oiq |
323-
| overlayImageCropping | oic |
324-
| overlayImageTrim | oit |
325-
| overlayText | ot |
326-
| overlayTextFontSize | ots |
327-
| overlayTextFontFamily | otf |
328-
| overlayTextColor | otc |
329-
| overlayTextTransparency | oa |
330-
| overlayAlpha | oa |
331-
| overlayTextTypography | ott |
332-
| overlayBackground | obg |
333-
| overlayTextEncoded | ote |
334-
| overlayTextWidth | otw |
335-
| overlayTextBackground | otbg |
336-
| overlayTextPadding | otp |
337-
| overlayTextInnerAlignment | otia |
338-
| overlayRadius | or |
339381
| progressive | pr |
340382
| lossless | lo |
341383
| trim | t |

0 commit comments

Comments
 (0)