{"id":7278,"date":"2023-11-30T12:38:24","date_gmt":"2023-11-30T12:38:24","guid":{"rendered":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/?page_id=7278"},"modified":"2023-11-30T12:45:53","modified_gmt":"2023-11-30T12:45:53","slug":"jpeg","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/software\/libraries\/jpeg\/","title":{"rendered":"JPEG"},"content":{"rendered":"<h2>Overview<\/h2>\n<p><a href=\"https:\/\/www.ijg.org\/\">libjpeg<\/a> is the Independent JPEG Group&#8217;s (IJG) widely used free library for JPEG image compression.<\/p>\n<p>There are no restrictions on access to the libjpeg installation on the CSF. All usage must adhere to this license restrictions listed under the &#8220;Legal Issues&#8221; section of the <code>$LIBJPEGDIR\/README<\/code> file in the installation.<\/p>\n<h2>Set up procedure<\/h2>\n<p>We now recommend loading modulefiles within your jobscript so that you have a full record of how the job was run. See the example jobscript below for how to do this. Alternatively, you may load modulefiles on the login node and let the job <abbr title=\"add '#$ -V' to your jobscript\">inherit these settings<\/abbr>.<\/p>\n<p>Load <strong>one<\/strong> of the following modulefiles to set up your environment:<\/p>\n<pre>\r\n# Load <strong>one<\/strong> of the following modulefiles\r\nmodule load libs\/gcc\/libjpeg\/9e\r\nmodule load libs\/gcc\/libjpeg\/8d\r\n<\/pre>\n<h2>Compiling a libjpeg-capable application<\/h2>\n<p>You will mostly use the libjpeg installation on CSF3 when compiling your own software. This allows you to add libjpeg functionality to your own apps. There are some tools you can also run to process existing image files (see below).<\/p>\n<p>The modulefiles will set an environment variable named <code>${LIBJPEGDIR}<\/code> which can then be used in your compilation process (e.g., in a Makefile or directly on the command-line) to access the header and library files:<\/p>\n<ul>\n<li>To inform the compiler of the header file directory use:\n<pre>gcc -I${LIBJPEGDIR}\/include ....<\/pre>\n<\/li>\n<li>To inform the compiler of the library files use:\n<pre>gcc ... -L${LIBJPEGDIR}\/lib -lproj<\/pre>\n<\/li>\n<li>In a Makefile ensure you use <code>${PROJDIR}<\/code> rather than <code>$LIBJPEGDIR<\/code>.<\/li>\n<\/ul>\n<p>An example compilation command could be<\/p>\n<pre>\r\ngcc -I${LIBJPEGDIR}\/include example_jpeg.c -o example_jepg -L${LIBJPEGDIR}\/lib -ljpeg\r\n<\/pre>\n<p>The modulefiles also set the following environment variables which can help compilers and build tools find the header and library files automatically: <code>PKG_CONFIG_PATH<\/code>, <code>C_INCLUDE_PATH<\/code>, <code>CPATH<\/code> and <code>LIBRARY_PATH<\/code>.<\/p>\n<h2>Running an libjpeg-capable application<\/h2>\n<p>You must load the libjpeg modulefile before running your PROJ-capable application (unless you have statically linked your code against the PROJ libraries). The modulefile will set the <code>LD_LIBRARY_PATH<\/code> variable to allow executables to find the share libraries at runtime.<\/p>\n<p>Please do not run libjpeg-capable applications on the login node. Jobs should be submitted to the compute nodes via batch.<\/p>\n<h3>Serial batch job submission<\/h3>\n<p>Create a batch submission script (which will load the modulefile in the jobscript), for example:<\/p>\n<pre>\r\n#!\/bin\/bash --login\r\n#$ -cwd             # Job will run from the current directory\r\n                    # NO -V line - we load modulefiles in the jobscript\r\n\r\n# Load the version you require\r\nmodule load libs\/gcc\/libjpeg\/9e\r\n\r\n# Run my application I compiled earlier\r\n.\/<em>myjpegapp<\/em> <em>arg1<\/em> ...\r\n<\/pre>\n<p>Submit the jobscript using: <\/p>\n<pre>qsub <em>scriptname<\/em><\/pre>\n<p>where <em>scriptname<\/em> is the name of your jobscript.<\/p>\n<h3>libjpeg Tools<\/h3>\n<p>The PROJ <code>bin<\/code> directory is added to your path so that you can access the <code>...jpeg<\/code> tools. Use <code>ls ${LIBJPEGBIN}<\/code> to see all binary tools:<\/p>\n<pre>\r\n# libjpeg tools - must be used in batch jobs, as above\r\ncjpeg  djpeg  jpegtran  rdjpgcom  wrjpgcom\r\n<\/pre>\n<h2>Further info<\/h2>\n<p>See the JPEG Clubs&#8217;s website for <a href=\"https:\/\/jpegclub.org\/\">documentation<\/a>.<\/p>\n<h2>Updates<\/h2>\n<p>None.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview libjpeg is the Independent JPEG Group&#8217;s (IJG) widely used free library for JPEG image compression. There are no restrictions on access to the libjpeg installation on the CSF. All usage must adhere to this license restrictions listed under the &#8220;Legal Issues&#8221; section of the $LIBJPEGDIR\/README file in the installation. Set up procedure We now recommend loading modulefiles within your jobscript so that you have a full record of how the job was run. See.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/software\/libraries\/jpeg\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":140,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-7278","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/7278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/comments?post=7278"}],"version-history":[{"count":3,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/7278\/revisions"}],"predecessor-version":[{"id":7283,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/7278\/revisions\/7283"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/140"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/media?parent=7278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}