Commit 6cba94a0 authored by Stephane Glondu's avatar Stephane Glondu

Imported Upstream version 4.1.1

parent 11b9c3df
repo: e37886d73a98029822983bee73a2d90ceb4b298b repo: e37886d73a98029822983bee73a2d90ceb4b298b
node: 668faa3494feaff8e7d79af79e9e393290e98107 node: e4e7c50d80c2160f914a129758023bbdd75d86d3
branch: 4.1.0 branch: 4.1.1
latesttag: v4.0.1 latesttag: v4.0.1
latesttagdistance: 56 latesttagdistance: 83
4.1.1
* omake --config clean up
* pkg-config is now used if exists in order to seek external libraries
4.1.0 4.1.0
* bmp was not linked with examples. Since bmp is pure ML libarary, * bmp was not linked with examples. Since bmp is pure ML libarary,
you may need to add -linkall to linker command to your build script, you may need to add -linkall to linker command to your build script,
......
=========================================================
CamlImages - Objective Caml image processing library CamlImages - Objective Caml image processing library
=========================================================
This library is reliable but still under development. Requirements
=================
*** Requirements To install CamlImages library, you need the following softwares:
To install CamlImages library, you need the following softwares: * OCaml 4.00.1 or higher (OCaml 3.11 and above might work with small trivial fixes, but never tested)
* Findlib (aka ocamlfind, http://www.camlcity.org/archive/programming/findlib.html )
* OCaml 4.00.1 or higher * OMake ( http://omake.metaprl.org/index.html )
(OCaml 3.11 and above might work with small trivial fixes,
but never tested)
* Findlib (aka ocamlfind,
http://www.camlcity.org/archive/programming/findlib.html)
* OMake (http://omake.metaprl.org/index.html)
Note that this is the minimum requirement: you can read/write BMP or Note that this is the minimum requirement: you can read/write BMP or
PXM (PPM, PGM, PBM) image formats but no other formats. If you want to PXM (PPM, PGM, PBM) image formats but no other formats. If you want to
deal with other image formats, you need to install the corresponding deal with other image formats, you need to install the corresponding
external libraries: external libraries:
* libpng for PNG format * libpng for PNG format
http://www.libpng.org/pub/png/libpng.html * libjpeg for JPEG format
http://sourceforge.net/projects/libpng/ * libexif for EXIF tags in JPEG files
* libtiff for TIFF format
* libjpeg for JPEG format * libxpm for XPM format (could be already by the X server installation)
The Independent JPEG Group's software * freetype for drawing texts using truetype fonts
ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz * libungif/libgif for GIF format
* ghostscript for PS format
* libexif for EXIF tags in JPEG files * lablgtk2, an OCaml interface to gtk+
* libtiff for TIFF format
http://www.libtiff.org/
ftp://ftp.remotesensing.org/pub/libtiff/
* libxpm for XPM format (could be already by the X server installation)
X contrib libraries ftp directory
ftp://ftp.x.org/contrib/libraries
* freetype for drawing texts using truetype fonts
The FREETYPE Project
http://sourceforge.net/projects/freetype/
* libungif for GIF format Installation
Libungif, a library for using GIFs =====================================
http://sourceforge.net/projects/libungif/
* ghostscript for PS format ::
See http://www.ghostscript.com/
* lablgtk2, an Objective Caml interface to gtk+ % yes no | omake --install
http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgtk.html % omake --configure <configuration options>
% omake install
*** Installation procedure by omake
% yes no | omake --install
% omake --configure <configuration options>
% omake install
At omake --configure, you can specify CFLAGS and LDFLAGS At omake --configure, you can specify CFLAGS and LDFLAGS
to add extra header and library search paths respectively. For example, to add extra header and library search paths respectively. For example,::
% omake --configure CFLAGS="-I /usr/include/libexif" LDFLAGS="-L/opt/blah" % omake --configure CFLAGS="-I /usr/include/libexif" LDFLAGS="-L/opt/blah"
List of configurable variables List of configurable variables
---------------------------------
CFLASG, INCLUDES, LDFLAGS: as usual.
CFLASG, INCLUDES, LDFLAGS: as usual. ARG_WANT_<feature>=bool
ARG_WANT_<feature>=bool
Without specifying ARG_WANT_<feature>, omake --configure automatically Without specifying ARG_WANT_<feature>, omake --configure automatically
searches the availability of <feature> and enables it when found. searches the availability of <feature> and enables it when found.
...@@ -77,21 +58,28 @@ List of configurable variables ...@@ -77,21 +58,28 @@ List of configurable variables
Currently the following features are available: Currently the following features are available:
GIF, PNG, JPEG, EXIF, TIFF, XPM, GS, LABLGTK2, GRAPHICS, FREETYPE GIF, PNG, JPEG, EXIF, TIFF, XPM, GS, LABLGTK2, GRAPHICS, FREETYPE
ARG_FREETYPE_CONFIG=string ARG_PATH_PKG_CONFIG=string
ARG_PATH_GS=string ARG_PATH_FREETYPE_CONFIG=string
PATH of freetype-config and gs. ARG_PATH_GS=string
PATH of external commands like pkg-config, freetype-config and gs
Without specifying, omake tries to find them in the PATH. Without specifying, omake tries to find them in the PATH.
Test Test
---- ----
Before you actually install the library, you can check that it
Before you actually install the library, you can check that it
really works, by running examples in the test directory. For the test really works, by running examples in the test directory. For the test
programs, programs,::
% cd test % cd test
% make % omake
% ./test % ./test
% ./test.run % ./test.run
(./test.run is the bytecode executable and ./test the binary (./test.run is the bytecode executable and ./test the binary
executable). executable).
Where to report building issues?
==========================================================
https://bitbucket.org/camlspotter/camlimages/issues?status=new&status=open
This diff is collapsed.
...@@ -70,10 +70,9 @@ where1(com) = ...@@ -70,10 +70,9 @@ where1(com) =
Check_prog_in_path(prog) = Check_prog_in_path(prog) =
ConfMsgChecking(for $(prog)) ConfMsgChecking(for $(prog))
WHERE = $(where1 $(prog)) WHERE = $(where1 $(prog))
export WHERE
if $(WHERE) if $(WHERE)
ConfMsgResult(found $(WHERE)) ConfMsgResult(found $(WHERE))
return true return $(WHERE)
else else
ConfMsgResult(FAILED - no $(prog) found) ConfMsgResult(FAILED - no $(prog) found)
return false return false
...@@ -162,7 +161,10 @@ ConfReplaceAt(file)= ...@@ -162,7 +161,10 @@ ConfReplaceAt(file)=
stdout = $(fopen $(file), w) stdout = $(fopen $(file), w)
fsubst($(file).in) fsubst($(file).in)
case $"@\([A-Z0-9_]+\)@" g case $"@\([A-Z0-9_]+\)@" g
getvar($1) if $(defined $1)
getvar($1)
else
value false
close($(stdout)) close($(stdout))
ConfReplaceConfigH(file)= ConfReplaceConfigH(file)=
...@@ -213,3 +215,18 @@ BuildExample(namex, modules, packages) = ...@@ -213,3 +215,18 @@ BuildExample(namex, modules, packages) =
############################################################################### ###############################################################################
pkg_config(name, libname) =
ConfMsgChecking(for $(libname) by pkg-config)
if $(and $(defined this.PATH_PKG_CONFIG), $(equal 0, $(shell-code $(PATH_PKG_CONFIG) $(libname))))
# this is required since it is called in .STATIC
setvar(this.LDFLAGS_$(name), $(shell $(PATH_PKG_CONFIG) --libs $(libname)))
setvar(this.CFLAGS_$(name), $(shell $(PATH_PKG_CONFIG) --cflags $(libname)))
setvar(this.SUPPORT_$(uppercase $(name)), true)
setvar(this.HAVE_$(uppercase $(name)), true)
ConfMsgResult(found)
export
value true
else
ConfMsgResult(failed $(PATH_PKG_CONFIG) $(libname))
value false
export
========================================================
CamlImages - Objective Caml image processing library CamlImages - Objective Caml image processing library
========================================================
The latest released version is 4.1.0.
========================================================
Note: This library is currently under development. Note: This library is currently under development.
========================================================
0. What is CamlImages ? What is CamlImages ?
========================================================
This is an image processing library, which provides some basic This is an image processing library, which provides some basic
functions of image processing and loading/saving various image file functions of image processing and loading/saving various image file
...@@ -10,35 +17,40 @@ formats. In addition the library can handle huge images that cannot be ...@@ -10,35 +17,40 @@ formats. In addition the library can handle huge images that cannot be
(or can hardly be) stored into the memory (the library automatically (or can hardly be) stored into the memory (the library automatically
creates swap files and escapes them to reduce the memory usage). creates swap files and escapes them to reduce the memory usage).
1. Installation Installation
========================================================
Read the file INSTALL. Read the file INSTALL.txt
2. Using CamlImages Using CamlImages
========================================================
2.1 Color models Color models
--------------------------------------------------------
CamlImages supports the following color models: CamlImages supports the following color models:
* Rgb24 -- 24bit depth full color image * Rgb24 -- 24bit depth full color image
* Index8 -- 8bit depth indexed image with transparent information * Index8 -- 8bit depth indexed image with transparent information
* Index16 -- 16bit depth indexed image with transparent information * Index16 -- 16bit depth indexed image with transparent information
For each color models, the corresponding module is provided. Use the module For each color models, the corresponding module is provided. Use the module
Rgb24 if you want to access 24bit depth full color images, for example. Rgb24 if you want to access 24bit depth full color images, for example.
2.2 Load/Save image files and other fancy features Load/Save image files and other fancy features
--------------------------------------------------------
CamlImages supports loading and saving of the following file formats: CamlImages supports loading and saving of the following file formats:
Bitmap (.bmp) * Bitmap (.bmp)
Tiff (.tiff or .tif), color only * Tiff (.tiff or .tif), color only
Jpeg (.jpeg or .jpg) * Jpeg (.jpeg or .jpg)
Png (.png) * Png (.png)
Ppm (.pbm, .pgm, .ppm), portable pixmaps * Ppm (.pbm, .pgm, .ppm), portable pixmaps
PS (.ps, .eps), PostScript files * PS (.ps, .eps), PostScript files
X Pixmap (.xpm), no saving * X Pixmap (.xpm), no saving
Gif (.gif) (not recommended) * Gif (.gif) (not recommended)
* EXIF tag
For each image format, we provide a separate module. For instance, For each image format, we provide a separate module. For instance,
there is a Tiff module to load and save images stored in the tiff file there is a Tiff module to load and save images stored in the tiff file
...@@ -55,59 +67,60 @@ the Graphics window). ...@@ -55,59 +67,60 @@ the Graphics window).
You can also draw strings on images using the Freetype library, which You can also draw strings on images using the Freetype library, which
is an external library to load and render TrueType fonts. is an external library to load and render TrueType fonts.
2.3 Class interface Class interface
--------------------------------------------------------
The modules begins the letter 'o' are the class interface for CamlImages. The modules begins the letter 'o' are the class interface for CamlImages.
2.4 Image swap Image swap
--------------------------------------------------------
When you create/load a huge image, the computer memory may not be When you create/load a huge image, the computer memory may not be
sufficient to contain all the data. (For example, this may happen if sufficient to contain all the data. (For example, this may happen if
you are working with a scanned image of A4, 720dpi, 24bit fullcolor, you are working with a scanned image of A4, 720dpi, 24bit fullcolor,
even if you have up to 128Mb of memory!) To work with such huge even if you have up to 128Mb of memory!)
(Well, my son, the first version of this document was written around 1998,
and computers had less memory at that time.)
To work with such huge
images, CamlImages provides image swaps, which can escape part of the images, CamlImages provides image swaps, which can escape part of the
images into files stored on the hard disk. A huge image is thus images into files stored on the hard disk. A huge image is thus
partitioned into several blocks and if there is not enough free partitioned into several blocks and if there is not enough free
memory, the blocks which have not been accessed recently are swapped memory, the blocks which have not been accessed recently are swapped
to temporary files. If a program requests to access to such a swapped to temporary files. If a program requests to access to such a swapped
block, the library silently loads it back into memory. block, the library silently loads it back into memory.
By default, image swapping is disabled, because it slows down the
By default, image swapping is disabled, because it slows down the
programs. To activate this function, you have to modify programs. To activate this function, you have to modify
Bitmap.maximum_live and Bitmap.maximum_block_size. Bitmap.maximum_live Bitmap.maximum_live and Bitmap.maximum_block_size. Bitmap.maximum_live
is the maximum heap live data size of the program (in words) and is the maximum heap live data size of the program (in words) and
Bitmap.maximum_block_size is the maximum size of swap blocks (in Bitmap.maximum_block_size is the maximum size of swap blocks (in
words). words).
For example, if you do not want to use more than 10M words (that is
For example, if you do not want to use more than 10M words (that is
40Mb for a 32bit architecture or 80Mb for a 64bit architecture), set 40Mb for a 32bit architecture or 80Mb for a 64bit architecture), set
Bitmap.maximum_live to 10000000. You may (and you should) enable heap Bitmap.maximum_live to 10000000. You may (and you should) enable heap
compaction, look at the GC interface file, gc.mli, in the standard compaction, look at the GC interface file, gc.mli, in the standard
library for more details (you should change the compaction configuration). library for more details (you should change the compaction configuration).
Bitmap.maximum_block_size affects the speed and frequency of image
Bitmap.maximum_block_size affects the speed and frequency of image
block swapping. If it is larger, each swapping becomes slower. If it block swapping. If it is larger, each swapping becomes slower. If it
is smaller, more swappings will occur. Too large and too small is smaller, more swappings will occur. Too large and too small
maximum_block_size, both may make the program slower. I suggest to maximum_block_size, both may make the program slower. I suggest to
have maximum_block_size set to !Bitmap.maximum_live / 10. have maximum_block_size set to !Bitmap.maximum_live / 10.
If you activated image swapping, cache files for unused swapped
If you activated image swapping, cache files for unused swapped
blocks will be removed automatically by Caml GC finalization, blocks will be removed automatically by Caml GC finalization,
but you may free them explicitly by hand also. The functions and methods but you may free them explicitly by hand also. The functions and methods
named "destroy" will free those blocks. named "destroy" will free those blocks.
The swap files are usually created in the /tmp directory. If you
The swap files are usually created in the /tmp directory. If you
set the environment variable "CAMLIMAGESTMPDIR", then its value set the environment variable "CAMLIMAGESTMPDIR", then its value
replaces the default "/tmp" directory. The temporary files are erased replaces the default "/tmp" directory. The temporary files are erased
when the program exits successfully. In other situations, for instance when the program exits successfully. In other situations, for instance
in case of spurious exception, you may need to erase temporary files in case of spurious exception, you may need to erase temporary files
manually. manually.
3. Miscellaneous Where to report issues?
==========================================================
3.1 How do I organize my Makefile to use the library ?
Put the following line at the top of your Makefile:
include /usr/local/lib/ocaml/camlimages/Makefile.config
The library directory can be different if the library is installed https://bitbucket.org/camlspotter/camlimages/issues?status=new&status=open
somewhere else. The variables COMPFLAGS_CAMLIMAGES
and LINKFLAGS_CAMLIMAGES are defined in Makefile.config; you should
add them to the compiler and linker options. A sample Makefile is
available at sample/Makefile.sample.
Image processing library
An image processing library, which provides loading and saving various
image formats with an interface for the Caml graphics library. It has
also an interface with the freetype library to draw texts using
truetype fonts.
opam-version: "1"
maintainer: "jun.furuse@gmail.com"
build: [
["omake"]
["omake" "install"]
]
remove: [
["ocamlfind" "remove" "camlimages"]
]
depends: ["ocamlfind" "lablgtk" "omake"]
archive: "https://bitbucket.org/camlspotter/camlimages/get/v4.0.1.tar.gz"
Image processing library
An image processing library, which provides loading and saving various
image formats with an interface for the Caml graphics library. It has
also an interface with the freetype library to draw texts using
truetype fonts.
opam-version: "1"
maintainer: "jun.furuse@gmail.com"
build: [
["omake"]
["omake" "install"]
]
remove: [
["ocamlfind" "remove" "camlimages"]
]
depends: ["ocamlfind" "omake"]
depopts: ["lablgtk"]
homepage: "http://cristal.inria.fr/camlimages/"
license: "LGPL-2 with OCaml linking exception"
authors: [
"Jun Furuse"
"François Pessaux"
"Pierre Weis"
]
archive: "https://bitbucket.org/camlspotter/camlimages/get/4.0.2.tar.gz"
Image processing library
An image processing library, which provides loading and saving various
image formats with an interface for the Caml graphics library. It has
also an interface with the freetype library to draw texts using
truetype fonts.
opam-version: "1"
maintainer: "jun.furuse@gmail.com"
build: [
["omake" "--configure" "INCLUDES=/usr/include/libexif"]
["omake" "install"]
]
remove: [
["ocamlfind" "remove" "camlimages"]
]
depends: ["ocamlfind" "base-unix" "omake"]
depopts: ["lablgtk"]
homepage: "http://cristal.inria.fr/camlimages/"
license: "LGPL-2 with OCaml linking exception"
authors: [
"Jun Furuse"
"François Pessaux"
"Pierre Weis"
]
archive: "https://bitbucket.org/camlspotter/camlimages/get/4.1.0.tar.gz"
Image processing library
An image processing library, which provides loading and saving various
image formats with an interface for the Caml graphics library. It has
also an interface with the freetype library to draw texts using
truetype fonts.
opam-version: "1"
maintainer: "jun.furuse@gmail.com"
build: [
["omake" "--configure"]
["omake" "install"]
]
remove: [
["ocamlfind" "remove" "camlimages"]
]
depends: ["ocamlfind" "base-unix" "omake"]
depopts: ["lablgtk"]
ocaml-version: [>= "4.00.1"]
homepage: "https://bitbucket.org/camlspotter/camlimages"
license: "LGPL-2 with OCaml linking exception"
authors: [
"Jun Furuse"
"François Pessaux"
"Pierre Weis"
]
archive: "https://bitbucket.org/camlspotter/camlimages/get/4.1.1.tar.gz"
Image processing library
An image processing library, which provides loading and saving various
image formats with an interface for the Caml graphics library. It has
also an interface with the freetype library to draw texts using
truetype fonts.
opam-version: "1"
maintainer: "jun.furuse@gmail.com"
build: [
["omake" "--configure"]
["omake" "install"]
]
remove: [
["ocamlfind" "remove" "camlimages"]
]
depends: ["ocamlfind" "base-unix" "omake"]
depopts: ["lablgtk"]
ocaml-version: [>= "4.00.1"]
homepage: "https://bitbucket.org/camlspotter/camlimages"
license: "LGPL-2 with OCaml linking exception"
authors: [
"Jun Furuse"
"François Pessaux"
"Pierre Weis"
]
...@@ -200,7 +200,14 @@ PACKS_lablgtk2[]= ...@@ -200,7 +200,14 @@ PACKS_lablgtk2[]=
################################################################## C BUILD RULE ################################################################## C BUILD RULE
CFLAGS+= -fPIC -I $(OCAML_WHERE) CFLAGS_supported=
x=
foreach(p, $(SUPPORTED_SUBPACKAGES))
x+= $(getvar CFLAGS_$(p))
export
value $(x)
CFLAGS+= -fPIC -I $(OCAML_WHERE) $(CFLAGS_supported)
MakeLibC(name) = MakeLibC(name) =
OCamlMkLibC($(LIBRARY_PREFIX)_$(name), \ OCamlMkLibC($(LIBRARY_PREFIX)_$(name), \
......
...@@ -14,25 +14,26 @@ ...@@ -14,25 +14,26 @@
(* $Id: camlimages.ml.in,v 1.3.2.1 2010/05/13 13:14:47 furuse Exp $ *) (* $Id: camlimages.ml.in,v 1.3.2.1 2010/05/13 13:14:47 furuse Exp $ *)
let version = "@VERSION@";; let version = "@VERSION@"
(* Supported libraries *) (* Supported libraries *)
let lib_gif = @SUPPORT_GIF@;; let lib_gif = @SUPPORT_GIF@
let lib_png = @SUPPORT_PNG@;; let lib_png = @SUPPORT_PNG@
let lib_jpeg = @SUPPORT_JPEG@;; let lib_jpeg = @SUPPORT_JPEG@
let lib_tiff = @SUPPORT_TIFF@;; let lib_tiff = @SUPPORT_TIFF@
let lib_freetype = @SUPPORT_FREETYPE@;; let lib_freetype = @SUPPORT_FREETYPE@
let lib_ps = @SUPPORT_PS@;; let lib_ps = @SUPPORT_PS@
let lib_xpm = @SUPPORT_XPM@;; let lib_xpm = @SUPPORT_XPM@
let lib_exif = @SUPPORT_EXIF@
(* External files *) (* External files *)
let path_rgb_txt = "@PATH_RGB_TXT@";; let path_rgb_txt = "@PATH_RGB_TXT@"
let path_gs = "@PATH_GS@";; let path_gs = "@PATH_GS@"
(* They are written in ML, so always supported *) (* They are written in ML, so always supported *)
let lib_ppm = true;; let lib_ppm = true
let lib_bmp = true;; let lib_bmp = true
let lib_xvthumb = true;; let lib_xvthumb = true
(* Word size, used for the bitmap swapping memory management *) (* Word size, used for the bitmap swapping memory management *)
let word_size = @WORD_SIZE@;; let word_size = @WORD_SIZE@
...@@ -23,15 +23,21 @@ ...@@ -23,15 +23,21 @@
#include "oversized.h" #include "oversized.h"
/* These are defined in caml/config.h */ // This is to resolve the conflict of these int types in caml/config.h and tiff.h
// Replace all the occurrences of (u?int[0-9]+) by $1_tiff, tiff.h's int types have
// now different names from caml's.
#undef int16 #undef int16
#undef uint16 #undef uint16
#undef int32 #undef int32
#undef uint32 #undef uint32
#define int16 int16tiff #undef int64
#define uint16 uint16tiff #undef uint64
#define int32 int32tiff #define int16 int16_tiff
#define uint32 uint32tiff #define uint16 uint16_tiff
#define int32 int32_tiff
#define uint32 uint32_tiff
#define int64 int64_tiff
#define uint64 uint64_tiff
#include <tiffio.h> #include <tiffio.h>
......
...@@ -20,15 +20,21 @@ ...@@ -20,15 +20,21 @@
#include <caml/memory.h> #include <caml/memory.h>
#include <caml/fail.h> #include <caml/fail.h>
/* These are defined in caml/config.h */ // This is to resolve the conflict of these int types in caml/config.h and tiff.h
// Replace all the occurrences of (u?int[0-9]+) by $1_tiff, tiff.h's int types have
// now different names from caml's.
#undef int16 #undef int16
#undef uint16 #undef uint16
#undef int32 #undef int32
#undef uint32 #undef uint32
#define int16 int16tiff #undef int64
#define uint16 uint16tiff #undef uint64
#define int32 int32tiff #define int16 int16_tiff
#define uint32 uint32tiff #define uint16 uint16_tiff
#define int32 int32_tiff
#define uint32 uint32_tiff
#define int64 int64_tiff
#define uint64 uint64_tiff
#include <tiffio.h> #include <tiffio.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment