Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: resampling an image using GD not working on Linux

by stefbv (Curate)
on Dec 07, 2016 at 12:39 UTC ( #1177382=note: print w/replies, xml ) Need Help??


in reply to resampling an image using GD not working on Linux

I played a little with the program (from GitHub) and the warning is printed when one of the parameters is 0 (zero).

Considering files[0] .../picwoodpecker/2016_..._0.jpg 568 0 GD Warning: one parameter to a memory allocation multiplication is neg +ative or zero, failing operation gracefully

The first parameter number is '$small_w' and the second is '$small_h', from the code line:

my $resized = GD::Image->new($small_w,$small_h);

Update: made a clarification.

Best regards, Stefan

Replies are listed 'Best First'.
Re^2: resampling an image using GD not working on Linux
by Discipulus (Abbot) on Dec 08, 2016 at 14:26 UTC
    thanks stefbv for the feedback!

    If I understand you added a print for field 1 and 2 of the current photo and you got a zero for the heigth?

    This is probably a big design error from my part: I get width and heigth of the original pic from exif tags. Tags are read during the build list phase: i probably need to add a fall back method (using GD) to get anyway sizes if exif tags ones are not found.

    If using the same photo you launch the program with the -debug flag you also view the current photo array dumped to the screen as received by the draw_photo sub.

    In the following output the photo shows a width of 2560 and an heigth of 1920: you get a zero with your photo?

    Considering files[0] C:\ulisse\img-renamer\2008_09_22_17_56_21_12.jpg photo data NOT defined for files[0] filled photo data for current: files[0] HERE draw_photo got: ------> C:\ulisse\path\photo.jpg|2560|1920|undef|undef|THUMB|PHOTO current 0 preload [1] filled files[1] photo data zero or other non significant increment for nex_pic OK loaded 2 photo data for files[0,1]

    I added an issue to the github project.

    While i still have many problems (no photos displayed) on Ubuntu I setup a Centos with perl 5.10 and GD 2.44 picwoodpecker runs quite well..

    thanks again for your time and sorry for the late reply (here is big holiday weekend)!

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
      If I understand you added a print for field 1 and 2 of the current photo and you got a zero for the heigth?

      Yes, that is what I did.

      Forgot to mention that my OS is Slackware64 and GD is v2.56. With the '-debug' flag, the output is:

      Considering files[0] /home/.../picwoodpecker/2016_11_11_12_50_13_0.jpg photo data NOT defined for files[0] filled photo data for current: files[0] draw_photo got: /home/.../picwoodpecker/2016_11_11_12_50_13_0.jpg|2272|1704|un +def|undef|THUMB|PHOTO GD Warning: one parameter to a memory allocation multiplication is neg +ative or zero, failing operation gracefully

      Regards, Stefan

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1177382]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (None)
    As of 2021-10-21 02:57 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My first memorable Perl project was:







      Results (82 votes). Check out past polls.

      Notices?