# ImageKit Watermark Positions: The 9 Supported Anchor Points

> Explore the 9 supported watermark positions in ImageKit from corners to center, with easy configuration for your images.

- Repository: [hzbd/imagekit](https://github.com/hzbd/imagekit)
- Tags: api-reference
- Published: 2026-03-03

---

**ImageKit supports nine distinct watermark anchor points including all four corners, four edge centers, and the image center, with South-East (lower-right) as the default position.**

The `hzbd/imagekit` Rust library provides precise text overlay control through the `WatermarkPosition` enum. These **imagekit watermark positions** eliminate manual coordinate calculations by automatically aligning watermarks to predefined anchor points relative to the image boundaries.

## Supported Watermark Positions

ImageKit defines nine anchor points in the `WatermarkPosition` enum located in [`src/cli.rs`](https://github.com/hzbd/imagekit/blob/main/src/cli.rs). The following positions are available via case-insensitive CLI arguments:

| Anchor Point | CLI Value | Screen Location |
|--------------|-----------|-----------------|
| **North-West** | `nw` | Upper-left corner |
| **North** | `north` | Top edge, centered horizontally |
| **North-East** | `ne` | Upper-right corner |
| **West** | `west` | Left edge, centered vertically |
| **Center** | `center` | Exact geometric center of image |
| **East** | `east` | Right edge, centered vertically |
| **South-West** | `sw` | Lower-left corner |
| **South** | `south` | Bottom edge, centered horizontally |
| **South-East** | `se` | Lower-right corner (default) |

The string parsing logic implemented in the `FromStr` trait within [`src/cli.rs`](https://github.com/hzbd/imagekit/blob/main/src/cli.rs) accepts these values case-insensitively. If the user provides an invalid position, the parser returns a descriptive error defined in [`src/errors.rs`](https://github.com/hzbd/imagekit/blob/main/src/errors.rs).

## Coordinate Calculation Logic

When applying a watermark, the library converts the abstract `WatermarkPosition` into concrete pixel coordinates within the `add_watermark` function in [`src/processor.rs`](https://github.com/hzbd/imagekit/blob/main/src/processor.rs). The implementation uses a `match position` block to determine the alignment, applying a consistent **10-pixel padding** from the image edges to prevent text from touching the borders.

For corners and edges, the processor calculates the appropriate offset based on the text bounding box dimensions and the chosen anchor. If the specified text size exceeds image bounds, the library automatically scales the watermark to fit while preserving the selected position anchor.

## Using Watermark Positions

### Command Line Interface

You can specify positions via the `--watermark-position` argument in the CLI. The following examples demonstrate anchoring at different positions:

```bash

# Default position: South-East (lower-right)

imagekit -i ./input -o ./output --watermark-text "Demo"

# Explicitly set to top-center

imagekit -i ./input -o ./output \
  --watermark-text "Demo" --watermark-position north

# Left edge center

imagekit -i ./input -o ./output \
  --watermark-text "Demo" --watermark-position west

```

### Rust API

In Rust code, import `WatermarkPosition` from the CLI module and pass it directly to `add_watermark`:

```rust
use imagekit::{processor::add_watermark, cli::WatermarkPosition};
use rusttype::Font;

// Assuming img is a DynamicImage and fonts are loaded
let position = WatermarkPosition::NorthEast; // Upper-right corner
add_watermark(&mut img, "Copyright 2024", &fonts, 24, position, color);

```

You can also parse positions from strings using the standard `FromStr` implementation:

```rust
use std::str::FromStr;
use imagekit::cli::WatermarkPosition;

let pos = WatermarkPosition::from_str("center")?; // Returns WatermarkPosition::Center

```

## Error Handling

Invalid position strings trigger a specific error variant defined in [`src/errors.rs`](https://github.com/hzbd/imagekit/blob/main/src/errors.rs). The error message clearly indicates that the provided value does not match any supported anchor point, helping users correct typos or invalid inputs immediately.

## Summary

- ImageKit provides **nine watermark positions**: four corners, four edge centers, and the image center
- The `WatermarkPosition` enum is defined in [`src/cli.rs`](https://github.com/hzbd/imagekit/blob/main/src/cli.rs) with case-insensitive string parsing via `FromStr`
- **South-East** (`se`) serves as the default position when none is specified in the CLI or API
- Coordinate calculation occurs in [`src/processor.rs`](https://github.com/hzbd/imagekit/blob/main/src/processor.rs) with a standard 10-pixel padding from edges
- Invalid positions generate descriptive errors from [`src/errors.rs`](https://github.com/hzbd/imagekit/blob/main/src/errors.rs)
- Integration tests in [`tests/integration_test.rs`](https://github.com/hzbd/imagekit/blob/main/tests/integration_test.rs) exercise all nine positions including `WatermarkPosition::Se` and `WatermarkPosition::Center`

## Frequently Asked Questions

### What is the default watermark position in ImageKit?

**South-East** (`se`) is the default anchor point, placing the watermark in the lower-right corner of the image. This default is applied automatically when the `--watermark-position` argument is omitted in the CLI or when using default parameters in the Rust API.

### Are watermark position arguments case-sensitive?

No. The `FromStr` implementation in [`src/cli.rs`](https://github.com/hzbd/imagekit/blob/main/src/cli.rs) parses position strings case-insensitively, so `North`, `north`, and `NORTH` all resolve to `WatermarkPosition::North`.

### How does ImageKit prevent watermarks from touching image edges?

The processor applies a **10-pixel padding** buffer when calculating coordinates in [`src/processor.rs`](https://github.com/hzbd/imagekit/blob/main/src/processor.rs). This ensures text watermarks maintain consistent spacing from the image boundaries regardless of which anchor point is selected.

### Where can I find examples of all watermark positions in use?

The integration test suite in [`tests/integration_test.rs`](https://github.com/hzbd/imagekit/blob/main/tests/integration_test.rs) contains test cases exercising each `WatermarkPosition` variant, including `WatermarkPosition::Se`, `WatermarkPosition::Center`, and others. These tests verify correct pixel placement for each anchor point.