JPEG
Overview
libjpeg is the Independent JPEG Group’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 “Legal Issues” 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 the example jobscript below for how to do this. Alternatively, you may load modulefiles on the login node and let the job inherit these settings.
Load one of the following modulefiles to set up your environment:
# Load one of the following modulefiles module load libs/gcc/libjpeg/9e module load libs/gcc/libjpeg/8d
Compiling a libjpeg-capable application
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).
The modulefiles will set an environment variable named ${LIBJPEGDIR}
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:
- To inform the compiler of the header file directory use:
gcc -I${LIBJPEGDIR}/include ....
- To inform the compiler of the library files use:
gcc ... -L${LIBJPEGDIR}/lib -lproj
- In a Makefile ensure you use
${PROJDIR}
rather than$LIBJPEGDIR
.
An example compilation command could be
gcc -I${LIBJPEGDIR}/include example_jpeg.c -o example_jepg -L${LIBJPEGDIR}/lib -ljpeg
The modulefiles also set the following environment variables which can help compilers and build tools find the header and library files automatically: PKG_CONFIG_PATH
, C_INCLUDE_PATH
, CPATH
and LIBRARY_PATH
.
Running an libjpeg-capable application
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 LD_LIBRARY_PATH
variable to allow executables to find the share libraries at runtime.
Please do not run libjpeg-capable applications on the login node. Jobs should be submitted to the compute nodes via batch.
Serial batch job submission
Create a batch submission script (which will load the modulefile in the jobscript), for example:
#!/bin/bash --login #$ -cwd # Job will run from the current directory # NO -V line - we load modulefiles in the jobscript # Load the version you require module load libs/gcc/libjpeg/9e # Run my application I compiled earlier ./myjpegapp arg1 ...
Submit the jobscript using:
qsub scriptname
where scriptname is the name of your jobscript.
libjpeg Tools
The PROJ bin
directory is added to your path so that you can access the ...jpeg
tools. Use ls ${LIBJPEGBIN}
to see all binary tools:
# libjpeg tools - must be used in batch jobs, as above cjpeg djpeg jpegtran rdjpgcom wrjpgcom
Further info
See the JPEG Clubs’s website for documentation.
Updates
None.