prunk has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I have a question using the Image::Resize GD graphics library. Following the code presented in the example off of CPAN, I would like to retain the name of the file "large.jpg" as the name of the file being sent to standard output after it has been resized. Instead of thumbnail.jpg it would be large.jpg. I have tried various ways of doing working at this and I cannot wrap my head around it. Does $image contain the contents of the large.jpg? Why not type this below? Thank you in advance.
#!/usr/bin/perl -w use strict; use GD::Image; use Image::Resize; my $image = Image::Resize->new('20191212_150024.jpg'); $image = $image->resize(197,262); open(FH, '>'.$image); print FH $image->jpeg(); close(FH); # Result of running this code: Died at /usr/local/share/perl/5.26.1/Im +age/Resize.pm line 25. #original code below and it works from CPAN $image = Image::Resize->new("large.jpg"); $gd = $image->resize(120, 120); open(FH, '>thumbnail.jpg'); print FH $gd->jpeg(); close(FH);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Image::Resize Question
by GrandFather (Saint) on Jun 07, 2022 at 22:01 UTC | |
by prunk (Initiate) on Jun 07, 2022 at 22:31 UTC | |
|
Re: Image::Resize Question
by hippo (Archbishop) on Jun 07, 2022 at 21:46 UTC |