---
name: "Mojolicious::Plugin::AssetPack::Pipe::Png"
section: "3pm"
platform: "linux"
package: "libmojolicious-plugin-assetpack-perl"
version: "2.15-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Mojolicious::Plugin::AssetPack::Pipe::Png"
---

# Mojolicious::Plugin::AssetPack::Pipe::Png(3pm)

Crush PNG image files

## NAME

Mojolicious::Plugin::AssetPack::Pipe::Png - Crush PNG image files

## SYNOPSIS

### Application

```
  plugin AssetPack => {pipes => ["Png"]};
  # Forces the use of "optipng -clobber -preserve $input"
  app->asset->pipe("Png")->app("optipng");
  # Forces the use of "pngquant --speed 2 -"
  app->asset->pipe("Png")->app("pngquant");
  # Set custom application arguments:
  app->asset->pipe("Png")->app("pngquant")->app_args([qw(--speed 10 --ordered -)]);
```

## DESCRIPTION

Mojolicious::Plugin::AssetPack::Pipe::Png can be used to crush "png" image files.

This plugin has default settings for "pngquant" (default) and "optipng". Which will be the default in the future is unknown, so force the one you want in case that matters.

This pipe is EXPERIMENTAL. Feedback wanted.

TODO: Detect which application is installed and use the best available.

TODO: Add support for pngcrush.

## ATTRIBUTES

### app

```
  $str = $self->app;
  $self = $self->app("pngquant");
```

Can be used to set a custom application.

### app\_args

```
  $array = $self->app_args;
  $self = $self->app_args([qw(-clobber $input)]);
```

Can be used to set custom "app" arguments. The special `$input` string in the argument list will be replaced with the path to a temp file holding the image data.

If no `$input` element is found in the "app\_args" list, then STDIN and STDOUT will be used instead.

## METHODS

### process

See "process" in Mojolicious::Plugin::AssetPack::Pipe.

## SEE ALSO

Mojolicious::Plugin::AssetPack.
