App-ImageMagickUtils

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


    *   quality => *int* (default: 40)

        Quality setting (for JPEG/PNG), 1 (best compression, worst quality)
        to 100 (least compression, best quality).

    *   skip_downsized => *bool* (default: 1)

        Skip previously downsized images.

        By default, when given a filename that looks like it's already
        downsized, e.g. "foo.1024-q40.jpg" or "foo.q40.jpg", will skip
        downsizing. The "--no-skip-downsized" option will process such
        filenames nevertheless.

    *   skip_whatsapp => *bool* (default: 1)

        Skip WhatsApp images.

        By default, assuming that WhatsApp already compresses images, when
        given a filename that matches a WhatsApp image filename, e.g.

lib/App/ImageMagickUtils.pm  view on Meta::CPAN


_
        },
        skip_downsized => {
            summary => 'Skip previously downsized images',
            'summary.alt.bool.not' => 'Do not skip previously downsized images',
            schema => 'bool*',
            default => 1,
            description => <<'_',

By default, when given a filename that looks like it's already downsized, e.g.
`foo.1024-q40.jpg` or `foo.q40.jpg`, will skip downsizing. The
`--no-skip-downsized` option will process such filenames nevertheless.

_
        },
        %argspecs_delete,
    },
    args_rels => \%args_rels,
    features => {
        dry_run => 1,

lib/App/ImageMagickUtils.pm  view on Meta::CPAN

        #my $res = Filename::Image::check_image_filename(filename => $file);
        my ($width, $height, $fmt) = Image::Size::imgsize($file);
        unless ($width) {
            log_error "Filename '%s' is not image (%s), skipped", $file, $fmt;
            next FILE;
        }

        if ($skip_whatsapp) {
            require Regexp::Pattern::Filename::Image::WhatsApp;
            if ($file =~ $Regexp::Pattern::Filename::Image::WhatsApp::RE{filename_image_whatsapp}{pat}) {
                log_info "Filename '%s' looks like a WhatsApp image, skip downsizing due to --skip-whatsapp option is in effect", $file;
                next FILE;
            }
        }

        if ($skip_downsized) {
            if ($file =~ /\.(?:\d+p?-)?q(?:\d{1,3})\.\w+\z/) {
                log_info "Filename '%s' looks like it's already downsized, skip downsizing due to --skip-downsized option is in effect", $file;
                next FILE;
            }
        }

        my $q = $args{quality} // 40;
        my @convert_args = (
            $file,
        );

        my $downsized;

lib/App/ImageMagickUtils.pm  view on Meta::CPAN

(No description)

=item * B<quality> => I<int> (default: 40)

Quality setting (for JPEGE<sol>PNG), 1 (best compression, worst quality) to 100 (least compression, best quality).

=item * B<skip_downsized> => I<bool> (default: 1)

Skip previously downsized images.

By default, when given a filename that looks like it's already downsized, e.g.
C<foo.1024-q40.jpg> or C<foo.q40.jpg>, will skip downsizing. The
C<--no-skip-downsized> option will process such filenames nevertheless.

=item * B<skip_whatsapp> => I<bool> (default: 1)

Skip WhatsApp images.

By default, assuming that WhatsApp already compresses images, when given a
filename that matches a WhatsApp image filename, e.g. C<IMG-20220508-WA0001.jpg>
(will be checked using L<Regexp::Pattern::Filename::Image::WhatsApp>), will

script/downsize-image  view on Meta::CPAN

=item B<--no-downsize>

Alias for --downsize-to ''.

See C<--downsize-to>.

=item B<--no-skip-downsized>

Do not skip previously downsized images.

By default, when given a filename that looks like it's already downsized, e.g.
C<foo.1024-q40.jpg> or C<foo.q40.jpg>, will skip downsizing. The
C<--no-skip-downsized> option will process such filenames nevertheless.


=item B<--no-skip-whatsapp>

Do not skip WhatsApp images.

By default, assuming that WhatsApp already compresses images, when given a
filename that matches a WhatsApp image filename, e.g. C<IMG-20220508-WA0001.jpg>



( run in 0.492 second using v1.01-cache-2.11-cpan-64827b87656 )