Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > c109337651527e96d7bb9adc83c5b18a > files > 442

libvips-devel-7.18.2-1mdv2010.0.i586.rpm

<!-- manual page source format generated by PolyglotMan v3.2, -->
<!-- available at http://polyglotman.sourceforge.net/ -->

<html>
<head>
<title>IM_OPEN(3) manual page</title>
</head>
<body bgcolor='white'>
<a href='#toc'>Table of Contents</a><p>

<h2><a name='sect0' href='#toc0'>Name</a></h2>
im_open, im_open_local, im_open_local_array - open VIPS  image descriptor(s)

<h2><a name='sect1' href='#toc1'>Synopsis</a></h2>
#include &lt;vips/vips.h&gt; 
<p> IMAGE *im_open( const char *filename, const
char *mode ) 
<p> IMAGE *im_open_local( IMAGE *im, const char *filename, const
char *mode ) 
<p> int im_open_local_array( IMAGE *im,    IMAGE **out, int n,
const char *filename, const char *mode )<br>
 
<p> 
<h2><a name='sect2' href='#toc2'>Description</a></h2>
<a href='im_open.3.html'><b>im_open(3)</b></a>
 examines the mode string, and creates an appropriate
VIPS IMAGE descriptor. 
<p> <b>r </b> opens the named file for reading. If the file
is not in the native VIPS format for your machine, <a href='im_open.3.html'><b>im_open(3)</b></a>
 automatically
converts the file for you in memory. For some large files (eg. TIFF) this
may not be what you want: you should call the appropriate converter yourself,
and arrange for the conversion to take place on disc. See <a href='im_tiff2vips.3.html'><b>im_tiff2vips(3)</a>
,</b>
<a href='im_jpeg2vips.3.html'><b>im_jpeg2vips(3)</a>
,</b> <a href='im_png2vips.3.html'><b>im_png2vips(3)</a>
,</b> <a href='im_magick2vips.3.html'><b>im_magick2vips(3)</a>
,</b> and <a href='im_ppm2vips.3.html'><b>im_ppm2vips(3)</a>
.</b>

<p> <a href='im_open.3.html'><b>im_open(3)</b></a>
 can read files in most formats. 
<p> <b>w</b> opens the named file for
writing. It looks at the file name suffix to determine the type to write
-- for example: 
<p>   im_open( "fred.tif", "w" )<br>
 
<p> will write in TIFF format. 
<p> You can pass parameters to the conversion
functions encoded in the filename string. For example: 
<p>   im_open( "fred.tif:deflate",
"w" )<br>
 
<p> will write a deflate (ZIP) compressed TIFF file. See the man pages for
<a href='im_vips2tiff.3.html'><b>im_vips2tiff(3)</a>
,</b> <a href='im_vips2jpeg.3.html'><b>im_vips2jpeg(3)</a>
,</b> <a href='im_vips2png.3.html'><b>im_vips2png(3)</b></a>
 and <a href='im_vips2ppm.3.html'><b>im_vips2ppm(3)</b></a>
 for
details on all of the options available. 
<p> <b>t</b> creates a temporary memory buffer
image. 
<p> <b>p</b> creates a "glue" descriptor you can use to join two image processing
operations together. 
<p> <b>rw</b> opens the named file for reading and writing. This
will only work for VIPS files in a format native to your machine. It is
only for paintbox-type applications. 
<p> <a href='im_open_local.3.html'><b>im_open_local(3)</a>
 </b> is a convenience
function which opens an image descriptor as <a href='im_open.3.html'>im_open(3)</a>
, but makes it local
to im, that is, when im is closed, the descriptor created by <a href='im_open_local.3.html'>im_open_local(3)</a>

will be closed too. 
<p> <a href='im_open_local.3.html'><b>im_open_local(3)</a>
 </b> is handy for saving you from adding
many  <a href='im_close.3.html'><b>im_close(3)</a>
 </b> calls to escape points. Example: find the total of an
array of images. 
<p>   #include &lt;vips/vips.h&gt;<br>
 
<p>   int<br>
   total( IMAGE **in, int nin, IMAGE *out )<br>
   {<br>
     int i;<br>
     IMAGE *t1, *t2;<br>
 
<p>     if( nin &lt;= 0 ) {<br>
       im_errormsg( "total: nin should be &gt; 0" );<br>
       return( -1 );<br>
     }<br>
     else if( nin == 1 )<br>
       return( im_copy( *in, out ) );<br>
     else<br>
       for( t1 = *in, i = 1; i &lt; nin; i++ ) {<br>
         if( i + 1 == nin )<br>
 <tt> </tt>&nbsp;<tt> </tt>&nbsp;  t2 = out;<br>
 <tt> </tt>&nbsp;<tt> </tt>&nbsp;else if( !(t2 = im_open_local( out, "t2", "p" )) )<br>
           return( -1 );<br>
 
<p>         if( im_add( t1, in[i], t2 ) )<br>
           return( -1 );<br>
         t1 = t2;<br>
       }<br>
 
<p>     return( 0 );<br>
   }<br>
 
<p> This function will create many intermediate images, but does not need
to close them. Any which are created will be closed automatically when out
is closed by our caller. 
<p> <a href='im_open_local.3.html'><b>im_open_local(3)</a>
 </b> returns NULL on error, or if
its first parameter is NULL. 
<p> <a href='im_open_local_array.3.html'><b>im_open_local_array(3)</b></a>
 will open an array
of images, failing if any of the opens fail. It&rsquo;s handy if you need a number
of images for intermediates. Example: 
<p>   IMAGE *t[6];<br>
 
<p>   if( im_open_local_array( out, t, 6, "mytemps", "p" ) )<br>
     return( -1 );<br>
 
<p> opens 6 temp images (t[0] to t[5]). 
<p> 
<h2><a name='sect3' href='#toc3'>Return Value</a></h2>
The function returns
the image descriptor on success and NULL on error. 
<h2><a name='sect4' href='#toc4'>See Also</a></h2>
<a href='im_close.3.html'>im_close(3)</a>
,
<a href='im_vips2tiff.3.html'>im_vips2tiff(3)</a>
, <a href='im_vips2jpeg.3.html'>im_vips2jpeg(3)</a>
, <a href='im_vips2ppm.3.html'>im_vips2ppm(3)</a>
, <a href='im_tiff2vips.3.html'>im_tiff2vips(3)</a>
, <a href='im_jpeg2vips.3.html'>im_jpeg2vips(3)</a>
,
<a href='im_ppm2vips.3.html'>im_ppm2vips(3)</a>
. 
<h2><a name='sect5' href='#toc5'>Copyright</a></h2>
K. Martinez, 1992. 
<h2><a name='sect6' href='#toc6'>Author</a></h2>
K. Martinez.  <p>

<hr><p>
<a name='toc'><b>Table of Contents</b></a><p>
<ul>
<li><a name='toc0' href='#sect0'>Name</a></li>
<li><a name='toc1' href='#sect1'>Synopsis</a></li>
<li><a name='toc2' href='#sect2'>Description</a></li>
<li><a name='toc3' href='#sect3'>Return Value</a></li>
<li><a name='toc4' href='#sect4'>See Also</a></li>
<li><a name='toc5' href='#sect5'>Copyright</a></li>
<li><a name='toc6' href='#sect6'>Author</a></li>
</ul>
</body>
</html>