improved lisp interface to scaling, doc changed acordingly
[emacs.git] / README.imagemagick
blobff1831e8c8f090fd7932c1efed27e062df5b49c0
1 This is the imagemagick branch of Emacs. Imagemagick can now be used
2 to load many new image formats, and also do useful transforms like
3 scaling and rotation.
5 This file will attempt to contain draft NEWS, Changelog and manual
6 entries for the new functionality. 
8 You might need to regenerate the configure scripts:
9 aclocal
10 automake
11 autoheader
12 autoconf
13 ./configure --with-imagemagick
17 * TODO
18 #B _ complete documentation drafts below
20 #B X fix inconsistencys with spelling of imagemagick in the src
21 #B X report number of images in image bundle types somehow
22 Works like for "gif" support. Thanks to Juri Linkov.
23 #B X probably add pdf to inhibited types
24 #B X inhibit types is defconst should probably be defcustom
25 #B _ decide what to do with some uncommitted imagemagick support
26   functions for image size etc.
27 #B _ Test with more systems
28 Tested on Fedora 12 so far, and the libmagick that ships with it.
29 Ubuntu 8.04 was also tested, but it seems it ships a broken ImageMagick.
30 #B X Also need some way to handle render methods that only work on newer ImageMagicks
31 Is handled by configure now
33 * Some nits from Stefan Monnier
34 I just took a quick look at the code and I see the following nits to fix:
35 #B _ obviously a merge will have to come with a good ChangeLog.
36 #B X also the merge will need to come with documentation.  Maybe not in the
37    Texinfo form yet, but at least in the etc/NEWS with enough info that
38    describes the `scale' and other such arguments that someone can start
39    using them.
40 #B X the README talks about naming inconsistencies, I think these should be
41   fixed before a first commit (should be straightforward).
43 #B X the "let" in image.el should not be followed by a line break and the while
44    should be replaced by a dolist.
46 #B X the prototype of imagemagick_load_image has some odd indentation in ([[2010.06.14]])
47    its args, not sure what happened.
48 #B X a few lines in the C code break the 80columns limit.
49 #B X please use ANSI style function declarations rather than K&R for new code. ([[2010.06.14]])
50 #B X you can get rid of the prototypes by reordering the code. ([[2010.06.14]])
51 #B X the docstrings in DEFUN should not be indented (they'll display ([[2010.06.14]])
52    weirdly otherwise in C-h f).
53 #B X Some "{" are at the end of a for/if rather than on their own line. ([[2010.06.14]])
54 #B X why use "*( imtypes + i)" rather than "imtypes[i]"? ([[2010.06.14]])
55 #B X some "," lack a space after them. ([[2010.06.14]])
56 #B X several "=" and "==" lack spaces around them. ([[2010.06.14]])
59 * NEWS entry
60 ** ImageMagick support
61 It is now possible to use the Imagemagick library to load many new
62 image formats in Emacs.
64 To enable, use the following configure option:
65 --with-imagemagick
67 The new function (imagemagick-types) returns a list of image file
68 extensions that your installation of imagemagick supports.
70 The function (imagemagick-register-types) will enable the imagemagick
71 support for the extensions in imagemagick-types minus the types listed
72 in imagemagick-types-inhibit.
74 imagemagick-types-inhibit has the value  '(C HTML HTM TXT PDF) by default.
75 This means imagemagick will be used also to load jpeg files, if you
76 have both jpeg and imagemagick libraries linked. Add 'JPG to
77 imagemagick-types-inhibit if you do not want this.
79 imagemagick-render-type is a new variable which can be set to choose
80 between screen render methods.
82 - 0 is a conservative metod which works with older ImageMagick
83   versions. It is a bit slow, but robust.
85 - 1 utilizes a newer ImageMagick method   
88 Images loaded with imagemagick will support a couple of new display
89 specification behaviours:
91 - if the :width and :height keywords are specified, these values are
92 used for scaling the image. If only one of :width or :height is
93 specified, the other one will be calculated so as to preserve the
94 aspect ratio.If both :width and :height are specified, aspect ratio
95 will not be preserved.
97 - :rotation specifies a rotation angle in degrees.
99 - :index specifies which image inside an image bundle file format, such
100 as TIFF or DJVM, to view.
102 The image-metadata function can be used to retrieve the total number
103 of images in an image bundle. This is simmilar to how GIF files work.
105 - :crop is used to specify a croping area: (width height x y).  This
106 is similar to the slice image specification, but has a different
107 purpose. :crop removes the croped areas from memory, so its memory
108 efficient if you only need to view a certain part of the image. The
109 slice specification can be used to pick diferent parts of the same
110 image, so its more disk and display efficient.
113 * experimental
114 - :geometry takes a geometry string as defined by ImageMagick:
116 scale%            
117 scale-x%xscale-y% 
118 width             
119 xheight           
120 widthxheight      
121 widthxheight^     
122 widthxheight!     
123 widthxheight>     
124 widthxheight<     
125 area@             
126 {size}{offset}
127 {size}{+-}x{+-}y
129 See the ImageMagick manual for more information.
131 - :crop is used to specify a croping area, with the "{size}{offset}" syntax.
133 :geometry and :crop with a string argument, are both particular to
134 ImageMagick, whereas the lisp interface is more general. Currently it
135 seems like the lisp interface is good enough, so the string argument
136 interface will probably be removed.
138 * Changelog entry
139 2010-06-12 Joakim Verona <joakim@verona.se>
140            * image.c: Add support for ImageMagick. When HAVE_IMAGEMAGICK is
141            defined:
142            (imagemagick_image_p): New function to test for ImageMagic img.
143            (imagemagick_load): New function to load ImageMagick img.
144            (imagemagick_load_image): New function, helper for imagemagick_load
145            (imagemagick-types): New function.
146            (Qimagemagick): New Lisp_object.
147            * image.el:
148            (imagemagick-types-inhibit): New var.
149            (imagemagick-register-types): New function.
150            * config.in, Makefile.in, configure.in
152 * Manual entry
153 nothing yet, but the NEWS entry could be adapted.