Scroll to navigation

Mojolicious::Plugin::AssetPack::Pipe::Png(3) User Contributed Perl Documentation Mojolicious::Plugin::AssetPack::Pipe::Png(3)

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.

2024-12-12 perl v5.40.0