#!/usr/bin/perl -w use strict; use GD::Image; use Image::Resize; my $imagePath = '20191212_150024.jpg'; my $rawImage = Image::Resize->new($imagePath); my $smallImage = $rawImage->resize(197, 262); open my $outFH, '>', $imagePath or die "Can't create '$imagePath': $!"; print $outFH $smallImage->jpeg(); close $outFH;