| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 5 | <title>jpeg: libiptcdata Reference Manual</title> |
| 6 | <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> |
| 7 | <link rel="home" href="index.html" title="libiptcdata Reference Manual"> |
| 8 | <link rel="up" href="ch02.html" title="Format-specific Functions"> |
| 9 | <link rel="prev" href="ch02.html" title="Format-specific Functions"> |
| 10 | <link rel="next" href="ch03.html" title="Helper Functions"> |
| 11 | <meta name="generator" content="GTK-Doc V1.28 (XML mode)"> |
| 12 | <link rel="stylesheet" href="style.css" type="text/css"> |
| 13 | </head> |
| 14 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
| 15 | <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> |
| 16 | <td width="100%" align="left" class="shortcuts"> |
| 17 | <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> |
| 18 | <a href="#libiptcdata-jpeg.description" class="shortcut">Description</a></span> |
| 19 | </td> |
| 20 | <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> |
| 21 | <td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> |
| 22 | <td><a accesskey="p" href="ch02.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> |
| 23 | <td><a accesskey="n" href="ch03.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> |
| 24 | </tr></table> |
| 25 | <div class="refentry"> |
| 26 | <a name="libiptcdata-jpeg"></a><div class="titlepage"></div> |
| 27 | <div class="refnamediv"><table width="100%"><tr> |
| 28 | <td valign="top"> |
| 29 | <h2><span class="refentrytitle"><a name="libiptcdata-jpeg.top_of_page"></a>jpeg</span></h2> |
| 30 | <p>jpeg</p> |
| 31 | </td> |
| 32 | <td class="gallery_image" valign="top" align="right"></td> |
| 33 | </tr></table></div> |
| 34 | <div class="refsect1"> |
| 35 | <a name="libiptcdata-jpeg.functions"></a><h2>Functions</h2> |
| 36 | <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| 37 | <colgroup> |
| 38 | <col width="150px" class="functions_return"> |
| 39 | <col class="functions_name"> |
| 40 | </colgroup> |
| 41 | <tbody> |
| 42 | <tr> |
| 43 | <td class="function_type"> |
| 44 | <span class="returnvalue">int</span> |
| 45 | </td> |
| 46 | <td class="function_name"> |
| 47 | <a class="link" href="libiptcdata-jpeg.html#iptc-jpeg-read-ps3" title="iptc_jpeg_read_ps3 ()">iptc_jpeg_read_ps3</a> <span class="c_punctuation">()</span> |
| 48 | </td> |
| 49 | </tr> |
| 50 | <tr> |
| 51 | <td class="function_type"> |
| 52 | <span class="returnvalue">int</span> |
| 53 | </td> |
| 54 | <td class="function_name"> |
| 55 | <a class="link" href="libiptcdata-jpeg.html#iptc-jpeg-ps3-find-iptc" title="iptc_jpeg_ps3_find_iptc ()">iptc_jpeg_ps3_find_iptc</a> <span class="c_punctuation">()</span> |
| 56 | </td> |
| 57 | </tr> |
| 58 | <tr> |
| 59 | <td class="function_type"> |
| 60 | <span class="returnvalue">int</span> |
| 61 | </td> |
| 62 | <td class="function_name"> |
| 63 | <a class="link" href="libiptcdata-jpeg.html#iptc-jpeg-ps3-save-iptc" title="iptc_jpeg_ps3_save_iptc ()">iptc_jpeg_ps3_save_iptc</a> <span class="c_punctuation">()</span> |
| 64 | </td> |
| 65 | </tr> |
| 66 | <tr> |
| 67 | <td class="function_type"> |
| 68 | <span class="returnvalue">int</span> |
| 69 | </td> |
| 70 | <td class="function_name"> |
| 71 | <a class="link" href="libiptcdata-jpeg.html#iptc-jpeg-save-with-ps3" title="iptc_jpeg_save_with_ps3 ()">iptc_jpeg_save_with_ps3</a> <span class="c_punctuation">()</span> |
| 72 | </td> |
| 73 | </tr> |
| 74 | </tbody> |
| 75 | </table></div> |
| 76 | </div> |
| 77 | <div class="refsect1"> |
| 78 | <a name="libiptcdata-jpeg.description"></a><h2>Description</h2> |
| 79 | </div> |
| 80 | <div class="refsect1"> |
| 81 | <a name="libiptcdata-jpeg.functions_details"></a><h2>Functions</h2> |
| 82 | <div class="refsect2"> |
| 83 | <a name="iptc-jpeg-read-ps3"></a><h3>iptc_jpeg_read_ps3 ()</h3> |
| 84 | <pre class="programlisting"><span class="returnvalue">int</span> |
| 85 | iptc_jpeg_read_ps3 (<em class="parameter"><code><span class="type">FILE</span> *infile</code></em>, |
| 86 | <em class="parameter"><code>unsigned <span class="type">char</span> *buf</code></em>, |
| 87 | <em class="parameter"><code>unsigned <span class="type">int</span> size</code></em>);</pre> |
| 88 | <p>Scans the headers of a JPEG file looking for a "Photoshop 3.0" header, and if |
| 89 | found, stores the raw contents of this header in the <em class="parameter"><code>buf</code></em> |
| 90 | buffer. The Photoshop |
| 91 | 3.0 header is a series of records found in the APP13 section of a JPEG file. |
| 92 | If a JPEG file contains IPTC metadata, the metadata is stored in one of the |
| 93 | Photoshop 3.0 records.</p> |
| 94 | <div class="refsect3"> |
| 95 | <a name="iptc-jpeg-read-ps3.parameters"></a><h4>Parameters</h4> |
| 96 | <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| 97 | <colgroup> |
| 98 | <col width="150px" class="parameters_name"> |
| 99 | <col class="parameters_description"> |
| 100 | <col width="200px" class="parameters_annotations"> |
| 101 | </colgroup> |
| 102 | <tbody> |
| 103 | <tr> |
| 104 | <td class="parameter_name"><p>infile</p></td> |
| 105 | <td class="parameter_description"><p>an open JPEG file with the current position set to the start of the file</p></td> |
| 106 | <td class="parameter_annotations"> </td> |
| 107 | </tr> |
| 108 | <tr> |
| 109 | <td class="parameter_name"><p>buf</p></td> |
| 110 | <td class="parameter_description"><p>an output buffer to store the Photoshop 3.0 data</p></td> |
| 111 | <td class="parameter_annotations"> </td> |
| 112 | </tr> |
| 113 | <tr> |
| 114 | <td class="parameter_name"><p>size</p></td> |
| 115 | <td class="parameter_description"><p>the size of the output buffer</p></td> |
| 116 | <td class="parameter_annotations"> </td> |
| 117 | </tr> |
| 118 | </tbody> |
| 119 | </table></div> |
| 120 | </div> |
| 121 | <div class="refsect3"> |
| 122 | <a name="iptc-jpeg-read-ps3.returns"></a><h4>Returns</h4> |
| 123 | <p> the number of bytes stored on success, 0 if the PS3 header was |
| 124 | not found, or -1 if an error occurred.</p> |
| 125 | </div> |
| 126 | </div> |
| 127 | <hr> |
| 128 | <div class="refsect2"> |
| 129 | <a name="iptc-jpeg-ps3-find-iptc"></a><h3>iptc_jpeg_ps3_find_iptc ()</h3> |
| 130 | <pre class="programlisting"><span class="returnvalue">int</span> |
| 131 | iptc_jpeg_ps3_find_iptc (<em class="parameter"><code>const unsigned <span class="type">char</span> *ps3</code></em>, |
| 132 | <em class="parameter"><code>unsigned <span class="type">int</span> ps3_size</code></em>, |
| 133 | <em class="parameter"><code>unsigned <span class="type">int</span> *iptc_len</code></em>);</pre> |
| 134 | <p>Parses a "Photoshop 3.0" header in search of IPTC metadata.</p> |
| 135 | <div class="refsect3"> |
| 136 | <a name="iptc-jpeg-ps3-find-iptc.parameters"></a><h4>Parameters</h4> |
| 137 | <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| 138 | <colgroup> |
| 139 | <col width="150px" class="parameters_name"> |
| 140 | <col class="parameters_description"> |
| 141 | <col width="200px" class="parameters_annotations"> |
| 142 | </colgroup> |
| 143 | <tbody> |
| 144 | <tr> |
| 145 | <td class="parameter_name"><p>ps3</p></td> |
| 146 | <td class="parameter_description"><p>the data of a Photoshop 3.0 header to search</p></td> |
| 147 | <td class="parameter_annotations"> </td> |
| 148 | </tr> |
| 149 | <tr> |
| 150 | <td class="parameter_name"><p>ps3_size</p></td> |
| 151 | <td class="parameter_description"><p>size in bytes of <em class="parameter"><code>ps3</code></em> |
| 152 | </p></td> |
| 153 | <td class="parameter_annotations"> </td> |
| 154 | </tr> |
| 155 | <tr> |
| 156 | <td class="parameter_name"><p>iptc_len</p></td> |
| 157 | <td class="parameter_description"><p>output parameter, the size in bytes of any found IPTC data</p></td> |
| 158 | <td class="parameter_annotations"> </td> |
| 159 | </tr> |
| 160 | </tbody> |
| 161 | </table></div> |
| 162 | </div> |
| 163 | <div class="refsect3"> |
| 164 | <a name="iptc-jpeg-ps3-find-iptc.returns"></a><h4>Returns</h4> |
| 165 | <p> the offset in bytes from the start of <em class="parameter"><code>ps3</code></em> |
| 166 | where a block |
| 167 | of IPTC metadata begins, 0 if no IPTC metadata was found, -1 on error.</p> |
| 168 | </div> |
| 169 | </div> |
| 170 | <hr> |
| 171 | <div class="refsect2"> |
| 172 | <a name="iptc-jpeg-ps3-save-iptc"></a><h3>iptc_jpeg_ps3_save_iptc ()</h3> |
| 173 | <pre class="programlisting"><span class="returnvalue">int</span> |
| 174 | iptc_jpeg_ps3_save_iptc (<em class="parameter"><code>const unsigned <span class="type">char</span> *ps3</code></em>, |
| 175 | <em class="parameter"><code>unsigned <span class="type">int</span> ps3_size</code></em>, |
| 176 | <em class="parameter"><code>const unsigned <span class="type">char</span> *iptc</code></em>, |
| 177 | <em class="parameter"><code>unsigned <span class="type">int</span> iptc_size</code></em>, |
| 178 | <em class="parameter"><code>unsigned <span class="type">char</span> *buf</code></em>, |
| 179 | <em class="parameter"><code>unsigned <span class="type">int</span> size</code></em>);</pre> |
| 180 | <p>Takes a Photoshop 3.0 header, <em class="parameter"><code>ps3</code></em> |
| 181 | , removes any existing IPTC data inside |
| 182 | that header, and inserts the new IPTC data from <em class="parameter"><code>iptc</code></em> |
| 183 | . Any other non-IPTC |
| 184 | portions of <em class="parameter"><code>ps3</code></em> |
| 185 | are left unmodified. If <em class="parameter"><code>ps3</code></em> |
| 186 | is NULL, a blank PS3 header |
| 187 | is created. If <em class="parameter"><code>iptc</code></em> |
| 188 | is NULL, the output PS3 header will contain no IPTC |
| 189 | data, even if <em class="parameter"><code>ps3</code></em> |
| 190 | originally contained some.</p> |
| 191 | <div class="refsect3"> |
| 192 | <a name="iptc-jpeg-ps3-save-iptc.parameters"></a><h4>Parameters</h4> |
| 193 | <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| 194 | <colgroup> |
| 195 | <col width="150px" class="parameters_name"> |
| 196 | <col class="parameters_description"> |
| 197 | <col width="200px" class="parameters_annotations"> |
| 198 | </colgroup> |
| 199 | <tbody> |
| 200 | <tr> |
| 201 | <td class="parameter_name"><p>ps3</p></td> |
| 202 | <td class="parameter_description"><p>a template PS3 header in which to insert the |
| 203 | new iptc data. Any non-IPTC data in this template will be preserved |
| 204 | in the output Photoshop 3.0 header. If NULL, a PS3 header will be |
| 205 | generated from scratch.</p></td> |
| 206 | <td class="parameter_annotations"> </td> |
| 207 | </tr> |
| 208 | <tr> |
| 209 | <td class="parameter_name"><p>ps3_size</p></td> |
| 210 | <td class="parameter_description"><p>size in bytes of <em class="parameter"><code>ps3</code></em> |
| 211 | </p></td> |
| 212 | <td class="parameter_annotations"> </td> |
| 213 | </tr> |
| 214 | <tr> |
| 215 | <td class="parameter_name"><p>iptc</p></td> |
| 216 | <td class="parameter_description"><p>the IPTC bytestream to be encapsulated in the PS3 output. The IPTC |
| 217 | bytestream can be generated with <a class="link" href="libiptcdata-data.html#iptc-data-save" title="iptc_data_save ()"><code class="function">iptc_data_save()</code></a>. If |
| 218 | NULL, the output will still be a valid PS3 header, but without any |
| 219 | contained IPTC data.</p></td> |
| 220 | <td class="parameter_annotations"> </td> |
| 221 | </tr> |
| 222 | <tr> |
| 223 | <td class="parameter_name"><p>iptc_size</p></td> |
| 224 | <td class="parameter_description"><p>size in bytes of <em class="parameter"><code>iptc</code></em> |
| 225 | </p></td> |
| 226 | <td class="parameter_annotations"> </td> |
| 227 | </tr> |
| 228 | <tr> |
| 229 | <td class="parameter_name"><p>buf</p></td> |
| 230 | <td class="parameter_description"><p>output buffer for the generated PS3 header</p></td> |
| 231 | <td class="parameter_annotations"> </td> |
| 232 | </tr> |
| 233 | <tr> |
| 234 | <td class="parameter_name"><p>size</p></td> |
| 235 | <td class="parameter_description"><p>size in bytes of <em class="parameter"><code>buf</code></em> |
| 236 | </p></td> |
| 237 | <td class="parameter_annotations"> </td> |
| 238 | </tr> |
| 239 | </tbody> |
| 240 | </table></div> |
| 241 | </div> |
| 242 | <div class="refsect3"> |
| 243 | <a name="iptc-jpeg-ps3-save-iptc.returns"></a><h4>Returns</h4> |
| 244 | <p> the number of bytes written to <em class="parameter"><code>buf</code></em> |
| 245 | ; -1 on error.</p> |
| 246 | </div> |
| 247 | </div> |
| 248 | <hr> |
| 249 | <div class="refsect2"> |
| 250 | <a name="iptc-jpeg-save-with-ps3"></a><h3>iptc_jpeg_save_with_ps3 ()</h3> |
| 251 | <pre class="programlisting"><span class="returnvalue">int</span> |
| 252 | iptc_jpeg_save_with_ps3 (<em class="parameter"><code><span class="type">FILE</span> *infile</code></em>, |
| 253 | <em class="parameter"><code><span class="type">FILE</span> *outfile</code></em>, |
| 254 | <em class="parameter"><code>const unsigned <span class="type">char</span> *ps3</code></em>, |
| 255 | <em class="parameter"><code>unsigned <span class="type">int</span> ps3_size</code></em>);</pre> |
| 256 | <p>Takes an existing JPEG file, <em class="parameter"><code>infile</code></em> |
| 257 | , removes any existing Photoshop |
| 258 | 3.0 header from it, and adds a new PS3 header, writing the output |
| 259 | to <em class="parameter"><code>outfile</code></em> |
| 260 | . <em class="parameter"><code>infile</code></em> |
| 261 | must be open for reading and is expected to point |
| 262 | to the beginning of the JPEG file, which should be different from <em class="parameter"><code>outfile</code></em> |
| 263 | , |
| 264 | which must be open for writing. If <em class="parameter"><code>ps3</code></em> |
| 265 | is NULL, the output will contain |
| 266 | no PS3 header. PS3 headers reside in the APP13 section of the JPEG file, |
| 267 | which is created if necessary. All other headers and data will be copied |
| 268 | directly from <em class="parameter"><code>infile</code></em> |
| 269 | without modification.</p> |
| 270 | <div class="refsect3"> |
| 271 | <a name="iptc-jpeg-save-with-ps3.parameters"></a><h4>Parameters</h4> |
| 272 | <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| 273 | <colgroup> |
| 274 | <col width="150px" class="parameters_name"> |
| 275 | <col class="parameters_description"> |
| 276 | <col width="200px" class="parameters_annotations"> |
| 277 | </colgroup> |
| 278 | <tbody> |
| 279 | <tr> |
| 280 | <td class="parameter_name"><p>infile</p></td> |
| 281 | <td class="parameter_description"><p>the file stream from which the image data is copied</p></td> |
| 282 | <td class="parameter_annotations"> </td> |
| 283 | </tr> |
| 284 | <tr> |
| 285 | <td class="parameter_name"><p>outfile</p></td> |
| 286 | <td class="parameter_description"><p>the output file stream</p></td> |
| 287 | <td class="parameter_annotations"> </td> |
| 288 | </tr> |
| 289 | <tr> |
| 290 | <td class="parameter_name"><p>ps3</p></td> |
| 291 | <td class="parameter_description"><p>the Photoshop 3.0 header to add to the output file</p></td> |
| 292 | <td class="parameter_annotations"> </td> |
| 293 | </tr> |
| 294 | <tr> |
| 295 | <td class="parameter_name"><p>ps3_size</p></td> |
| 296 | <td class="parameter_description"><p>size in bytes of <em class="parameter"><code>ps3</code></em> |
| 297 | </p></td> |
| 298 | <td class="parameter_annotations"> </td> |
| 299 | </tr> |
| 300 | </tbody> |
| 301 | </table></div> |
| 302 | </div> |
| 303 | <div class="refsect3"> |
| 304 | <a name="iptc-jpeg-save-with-ps3.returns"></a><h4>Returns</h4> |
| 305 | <p> 0 on success, -1 on error. Note that even in error, some data |
| 306 | may have been written to <em class="parameter"><code>outfile</code></em> |
| 307 | , and its contents should be considered |
| 308 | undefined.</p> |
| 309 | </div> |
| 310 | </div> |
| 311 | </div> |
| 312 | <div class="refsect1"> |
| 313 | <a name="libiptcdata-jpeg.other_details"></a><h2>Types and Values</h2> |
| 314 | </div> |
| 315 | </div> |
| 316 | <div class="footer"> |
| 317 | <hr>Generated by GTK-Doc V1.28</div> |
| 318 | </body> |
| 319 | </html> |