lucus
v0.1.0
Published
CDN for dev environment. A local server alternative to Cloudflare/Cloudinary image transformations
Readme
lucus
Lucus is a local files server which aims to replace image storage and other types of content in local and development environments. Lucus's ease of use lies in the fact that it serves the file system while respecting the folder structure, and includes functionalities on top of that.
Features
- Serves complete file systems, including folders
- Auto-generated directory indexes (optional)
- Query parameters for image transformations
- Streaming long files
Usage
CLI
You can directly run lucus as a command-line tool
npx lucus ~/My-folder --port=3210 --directory-listing | npx pino-prettyYou can also run it using the provided Dockerfile and docker-compose configuration
git clone https://github.com/aitorllj93/lucus.git
# create .env to provide some configuration
docker compose upHere’s the Lucus Image Transformations documentation in English, ready to paste into your README.
Image Transformations
Lucus supports on-the-fly image transformations via URL query parameters.
/image.jpg?param=value¶m=valueExample:
/photo.jpg?w=800&h=600&fit=cover&format=webp&q=80Supported Parameters
Size
w / width
Output width.
?w=800h / height
Output height.
?h=600fit
Resize mode.
Values:
covercontainfillinsideoutside
Example:
?w=800&h=600&fit=coverCrop / Position
g / gravity
Controls focal point.
Values:
centernorthsoutheastwestnortheastnorthwestsoutheastsouthwestentropyattention
?w=800&h=600&fit=cover&gravity=attentionFormat
f / format
Convert output format.
Supported:
jpegpngwebpavifgif
?format=webpQuality
q / quality
?q=80Range:
1 - 100Rotation
r / rotate
?rotate=90Also:
?rotate=180
?rotate=270Flip
flip
Vertical flip
?flip=trueflop
Horizontal flip
?flop=trueBlur
blur
?blur=5Range:
0.3 - 1000Sharpen
sharpen
?sharpen=trueor
?sharpen=2Grayscale
grayscale / grey
?grayscale=trueBackground
Used with transparency or contain.
bg / background
?background=ffffffAlso:
?background=000000
?background=transparentAnimation
animated
Allow transforming animated GIFs.
?animated=trueCombining Parameters
/image.jpg
?w=800
&h=600
&fit=cover
&gravity=attention
&format=webp
&q=80Examples
Thumbnail
?w=300&h=300&fit=coverHero Image
?w=1920&h=1080&fit=cover&gravity=attentionOptimized WebP
?format=webp&q=80Blur Placeholder
?w=20&blur=10Avatar
?w=200&h=200&fit=coverCaching
Transformations are cached automatically:
original + query params = cache keyExample:
/image.jpg?w=800cached separately from:
/image.jpg?w=400Full Example
/images/photo.jpg
?w=1200
&h=800
&fit=cover
&gravity=attention
&format=webp
&q=82
&sharpen=trueResult:
- resized to 1200×800
- smart crop
- converted to webp
- quality 82
- sharpen applied
- cached automatically
