Turn images into speechbubbled images!
Find a file
2025-01-25 08:00:33 +02:00
src fix: finally made it 2025-01-25 07:52:55 +02:00
.gitignore init 2025-01-25 07:08:20 +02:00
eslint.config.json init 2025-01-25 07:08:20 +02:00
eslint.config.mjs init 2025-01-25 07:08:20 +02:00
package.json 1.1.0 2025-01-25 07:53:03 +02:00
pnpm-lock.yaml init 2025-01-25 07:08:20 +02:00
README.md remove outdated development setup and publishing instructions from README 2025-01-25 07:31:33 +02:00
tsconfig.json init 2025-01-25 07:08:20 +02:00

Image Speech Bubble Transformer

A TypeScript library for applying speech bubble effects to images with various transformation options.

Installation

npm install image-speech-bubble-transformer

Usage

import {
  createSpeechBubbleTransformer,
  Orientation,
} from "image-speech-bubble-transformer";
import fs from "fs/promises";

async function example() {
  // Create transformer instance
  const transformer = createSpeechBubbleTransformer();

  // Read image buffer
  const inputBuffer = await fs.readFile("input.png");

  // Process image with options
  const processedBuffer = await transformer.processSpeechBubble(inputBuffer, {
    mirror: true,
    orientation: Orientation.LEFT,
  });

  // Save processed image
  await transformer.processAndSave(inputBuffer, "output.png", {
    mirror: true,
    orientation: Orientation.LEFT,
  });
}

API

createSpeechBubbleTransformer(assetsDir?: string)

  • Creates a transformer instance
  • assetsDir: Optional path to custom assets directory

processSpeechBubble(inputBuffer, options)

  • Applies speech bubble effect to image
  • Options:
    • mirror: Flip horizontally
    • orientation: Rotate speech bubble
    • speechBubblePath: Custom speech bubble image

processAndSave(inputBuffer, outputPath, options)

  • Processes and saves image in one step

Supported Formats

  • .png, .jpg, .jpeg, .gif, .bmp, .webp, .tiff