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);

In reply to Image::Resize Question by prunk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.