# Freeze (`janbuchar/freeze`) Actor

Freeze generates PNGs, SVGs, and WebPs of code and terminal output alike. This Actor is wrapper around the popular https://github.com/charmbracelet/freeze open-source repository.

- **URL**: https://apify.com/janbuchar/freeze.md
- **Developed by:** [Jan Buchar](https://apify.com/janbuchar) (community)
- **Categories:** Automation, Developer tools
- **Stats:** 3 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### What does the Actor do?

It wraps [freeze](https://github.com/charmbracelet/freeze), a CLI program that generates beautiful screenshots from source code. With Freeze, you can easily create visually appealing screenshots of your code snippets or entire source code files.

### Why use Freeze?

Freeze is perfect for developers, designers, and anyone who wants to showcase their code in a visually appealing way. Whether you want to share your code on social media, in presentations, or on your website, Freeze can help you create eye-catching screenshots quickly and easily.

Here are some ways you could use Freeze:

- Share code snippets on Twitter or LinkedIn
- Create visual documentation for your projects
- Showcase your code on your portfolio website
- Create visually appealing tutorials or blog posts

### How to use Freeze

It's simple to use Freeze to generate screenshots from source code. Just follow these steps:

1. Click on Try for free.
2. Enter the source code you want to screenshot.
3. Customize the appearance of your screenshot (optional).
4. Click on Run.
5. Once Freeze has finished, preview or download your screenshot from the Dataset tab.

### How much does Freeze cost?

Apify provides $5 free usage credits every month on the [Apify Free plan](https://apify.com/pricing). With Freeze, you can generate a certain number of screenshots per month for free using these credits.

If you need to generate more screenshots regularly, consider upgrading to a subscription plan. The Starter plan at $49/month allows for a higher number of screenshots per month, while the Scale plan at $499 provides even greater capacity.

### Results

Here is an example of the data that Freeze produces:

```json
{"image":"https://api.apify.com/v2/key-value-stores/m1Sqnke1KWM0AI8co/records/image_4242424242.png"}
```

Or as an image:

![code screenshot](https://github.com/charmbracelet/freeze/raw/main/test/golden/svg/shadow.svg)

### Tips for using Freeze

- Customize the appearance of your screenshots to match your brand or style.
- Experiment with different code snippets and settings to create unique and engaging screenshots.

# Actor input Schema

## `language` (type: `string`):

Language of your code snippet

## `code` (type: `string`):

URLs to start with

## `showLineNumbers` (type: `boolean`):

Show line numbers

## `window` (type: `boolean`):

Display window controls (Mac OS style window decorations)

## Actor input object example

```json
{
  "language": "python",
  "code": "print('Hello world!')",
  "showLineNumbers": true,
  "window": true
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "language": "python",
    "code": "print('Hello world!')"
};

// Run the Actor and wait for it to finish
const run = await client.actor("janbuchar/freeze").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "language": "python",
    "code": "print('Hello world!')",
}

# Run the Actor and wait for it to finish
run = client.actor("janbuchar/freeze").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "language": "python",
  "code": "print('\''Hello world!'\'')"
}' |
apify call janbuchar/freeze --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,janbuchar/freeze"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/SuDmiXYElsZjRU1sZ/builds/bMH9I8RD88YR1Jay5/openapi.json
