e file with PNG format and returns the PDL data.</p>

<pre><code> sub read_png {
    my ($png) = @_; 
    my $cr = PDL-&gt;rpiccan(&#39;PNG&#39;);   # is PNG format allowed
    if(! $cr ) { print &quot;Error (read): Png not allowed!\n&quot;; return 0; }
    my $tmp = PDL::IO::Pic::rpic($png, {FORMAT =&gt; &#39;PNG&#39;}); # read image
 }</code></pre>

<h2 id="write_png-data-filename">write_png($data,$filename);</h2>

<p>Writes a PDL image as PNG file.</p>

<pre><code> sub write_png {
    my ($img,$png) = @_