Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Okay, have finally given up on this and need some help. I've searched the web and have seen folks reply about this topic but the answers given were either a work-around for the person who originally needed help and the answer didn't fulfill the requirements for what I need or the web topic simply doesn't fit.

I'm basically trying to automate print-quality images using the GD module using a 300dpi source image. This source image is a backdrop to a final image that has text / charts / photos applied on top of it using GD. On every variation that I know about for opening and writing a new image file with GD, it will not create anything other than a final output image at 72dpi. I need to automate this because our group has to be able to output up to a dozen print-quality statistical report marketing pieces every month and it is very tedious doing it by hand.

This is being done on Windows 10. GD is at version 2.5 (latest). For my perl config, I have specified just these two load lines:
use GD;

I've created test input files at 300dpi (both jpg and png). Just to keep this simple, I've tried every combination of the following:

$source_image = GD::Image->newFromPng("300dpi_test.png",1);
#$source_image = GD::Image->newFromJpeg("300dpi_test.jpg",1);

#$blank_rgb_image = GD::Image->new(2550, 3300, 1 );
#my $blank_rgb_image = GD::Image->newTrueColor(2550, 3300);
binmode F;
print F $source_image->jpeg(90);
#print F $blank_rgb_image->jpeg(90);
#print F $blank_rgb_image->png;

I've tried to tell GD to open the source image with true color support and just dump the source image to a new file. No luck. I've tried opening the source at true color and then creating a new object image using true color (both with the "1" flag AND using the "newTrueColor" method) then copying+pasting the source image to the new image object... neither method works.

Yes, I could inflate the source size of the 300dpi Photoshop file backdrop image and then try to do everything in 72dpi then resample using Photoshop again after the changes are made but these files wind up being huge, the manipulated imaging pixels would be 4x the normal size and it would then require a 3rd party imaging editor to do the conversion back to 300dpi. There has to be a better solution so that everything can be done in the background... just not sure if GD can really do it.

Any help would be appreciated!

In reply to GD @ 300dpi output by themcp

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    Domain Nodelet?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others exploiting the Monastery: (8)
    As of 2024-07-18 08:05 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found

      erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.