How about this one?

Is there a simple way to "use Image::Magic;" (aka PerlMagick, the Perl API to ImageMagick) to create a new "dummy" PNG image out of the ether; that is, no reading in an existing PNG file?

I've been trying for over a week and no matter what I've tried, the "magick" of files I create (which I take to be the file format: like 'PNG') come back as 'MIFF'.

I don't want to pollute the thread with my scattershot stuff that hasn't worked; if you've got a short example, please share.

I will say that my goal is to manipulate the file and Write it after it's created. I don't want to worry about how to "save as a PNG" after doing all the work, and instead, am hoping to create the write type of file before any work is started.

I hit "create" to stumbit and then this works, creating a 10x10 pixel PNG file, which is recognized as a PNG when written and read back in (I'm kinda like a novice monk who sits at the outermost gate talking to hisself):

#!/usr/bin/perl use Image::Magick; my $image=Image::Magick->new(format=>'PNG',size='10x10'); # critical t +o solution was this "format" key my $err=$image->Read("canvas:orange"); warn "$err" if $err; # these are good ideas because PerlMagick sometim +es fails silently $err=$image->Write("CANVAS_ORANGE.png"); warn "$err" if $err; my $other=Image::Magick->new; my $err=$other->Read("CANVAS_ORANGE.png"); warn "$err" if $err; my $format=$other->Get('format'); my $magick=$other->Get('magick'); print "Format:$format Magick:$magick\n";

In reply to [SOLVED] PerlMagick (ImageMagick API): create a new "dummy" PNG file from the ether by Br'er Rabbit

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.