Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fresh_images/transformer.ts>rotate

Fresh plugin for manipulating images on-the-fly.
Latest
function rotate
import { rotate } from "https://deno.land/x/fresh_images@v0.3.0/transformer.ts";

Rotate an image by a given number of degrees.

Examples

Example 1

import { defineConfig } from "$fresh/server.ts";
import ImagesPlugin from "fresh_images/mod.ts";
import { rotate } from "fresh_images/transformer.ts";

export default defineConfig({
 plugins: [
  ImagesPlugin({
   publicPath: "/img",
  transformers: { rotate },
 }),
],

Example 2

<img src="/img/meow.jpg?fn=rotate&d=270" alt="Rotated 270 degrees" />
<img src="/img/meow.jpg?fn=rotate&rotateDegrees=90" alt="Rotated 90 degrees" />
<img src="/img/meow.jpg?fn=rotate&rotateDegrees=-45" alt="Rotated -45 degrees" />

Parameters

img: Image | GIF

Image to rotate

req: Request

URL request containing transformation parameters

Returns

Promise<Image | GIF>

Rotated image