From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: joakim@verona.se Newsgroups: gmane.emacs.devel Subject: Re: Image metadata Date: Fri, 02 Apr 2010 23:51:59 +0200 Message-ID: References: <87lje9xs4w.fsf@mail.jurta.org> <873a0d1j46.fsf@mail.jurta.org> <87vdd9rwia.fsf@mail.jurta.org> <87bpf0dmbn.fsf@mail.jurta.org> <874ojxhpqg.fsf_-_@mail.jurta.org> <87tyrx77v3.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1270245314 5934 80.91.229.12 (2 Apr 2010 21:55:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 2 Apr 2010 21:55:14 +0000 (UTC) Cc: Stefan Monnier , Emacs development discussions To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 02 23:55:09 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NxopY-0000Bb-UQ for ged-emacs-devel@m.gmane.org; Fri, 02 Apr 2010 23:55:09 +0200 Original-Received: from localhost ([127.0.0.1]:52466 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NxopY-00086u-CP for ged-emacs-devel@m.gmane.org; Fri, 02 Apr 2010 17:55:08 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nxop2-0007rN-4m for emacs-devel@gnu.org; Fri, 02 Apr 2010 17:54:36 -0400 Original-Received: from [140.186.70.92] (port=36820 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nxooz-0007mR-Pq for emacs-devel@gnu.org; Fri, 02 Apr 2010 17:54:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nxomp-00054g-Pm for emacs-devel@gnu.org; Fri, 02 Apr 2010 17:52:21 -0400 Original-Received: from iwfs.imcode.com ([82.115.149.64]:59141 helo=gate.verona.se) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nxomn-00054A-S5 for emacs-devel@gnu.org; Fri, 02 Apr 2010 17:52:19 -0400 Original-Received: from localhost.localdomain (IDENT:1005@localhost [127.0.0.1]) by gate.verona.se (8.13.4/8.11.4) with ESMTP id o32Lq05J012936; Fri, 2 Apr 2010 23:52:02 +0200 In-Reply-To: <87tyrx77v3.fsf@mail.jurta.org> (Juri Linkov's message of "Wed, 31 Mar 2010 01:38:36 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:123081 Archived-At: Juri Linkov writes: >>> The problem is that one part of the current `image-extension-data' >>> is metadata, and another part is extension data. For instance, in >> >>> (count 44 >>> 255 "NETSCAPE2.0" >>> 0 "^A^@^@" >>> 249 "^D^M^@\377" >>> ) >> >>> `count 44' is metadata, and the rest (with non-descriptive numeric keys) >>> is extension data. >> >> Not knowing what is "extension data", I don't know if I agree. > >>>From the API's point of view, "extension data" is just raw data fetched > from the `ExtensionBlocks' slot of the GIF metadata. So really it's not > important what it is as long as slot names basically coincide in the GIF > structure and in its Lisp image metadata. > > I believe this patch cleans up the naming mess: This does indeed seem clearer. Will this be commited? If so I would try to use this api in the imagemagick patch. For instance, it seems I can use MagickGetNumberImages() to get the 'count property for multifile image archives. > > === modified file 'lisp/image.el' > --- lisp/image.el 2010-03-11 20:01:33 +0000 > +++ lisp/image.el 2010-03-30 22:28:18 +0000 > @@ -681,8 +681,9 @@ (defun image-animated-p (image) > shall be displayed." > (cond > ((eq (plist-get (cdr image) :type) 'gif) > - (let* ((extdata (image-extension-data image)) > - (images (plist-get extdata 'count)) > + (let* ((metadata (image-metadata image)) > + (images (plist-get metadata 'count)) > + (extdata (plist-get metadata 'extension-data)) > (anim (plist-get extdata #xF9))) > (and (integerp images) (> images 1) > (stringp anim) (>= (length anim) 4) > > === modified file 'src/image.c' > --- src/image.c 2010-01-24 23:03:13 +0000 > +++ src/image.c 2010-03-30 22:31:57 +0000 > @@ -604,7 +604,7 @@ (at your option) any later version. > extern Lisp_Object QCwidth, QCheight, QCforeground, QCbackground, QCfile; > extern Lisp_Object QCdata, QCtype; > extern Lisp_Object Qcenter; > -Lisp_Object QCascent, QCmargin, QCrelief, Qcount; > +Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data; > Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask; > Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask; > > @@ -1011,8 +1011,8 @@ (at your option) any later version. > return mask; > } > > -DEFUN ("image-extension-data", Fimage_extension_data, Simage_extension_data, 1, 2, 0, > - doc: /* Return extension data for image SPEC. > +DEFUN ("image-metadata", Fimage_metadata, Simage_metadata, 1, 2, 0, > + doc: /* Return metadata for image SPEC. > FRAME is the frame on which the image will be displayed. FRAME nil > or omitted means use the selected frame. */) > (spec, frame) > @@ -7169,7 +7169,7 @@ (at your option) any later version. > struct frame *f; > struct image *img; > { > - /* IMG->data.ptr_val may contain extension data. */ > + /* IMG->data.ptr_val may contain metadata with extension data. */ > img->data.lisp_val = Qnil; > x_clear_image (f, img); > } > @@ -7488,8 +7488,8 @@ (at your option) any later version. > } > } > > - /* Save GIF image extension data for `image-extension-data'. > - Format is (count IMAGES FUNCTION "BYTES" ...). */ > + /* Save GIF image extension data for `image-metadata'. > + Format is (count IMAGES extension-data (FUNCTION "BYTES" ...)). */ > img->data.lisp_val = Qnil; > if (gif->SavedImages[ino].ExtensionBlockCount > 0) > { > @@ -7499,7 +7499,9 @@ (at your option) any later version. > img->data.lisp_val = Fcons (make_unibyte_string (ext->Bytes, ext->ByteCount), > Fcons (make_number (ext->Function), > img->data.lisp_val)); > - img->data.lisp_val = Fnreverse (img->data.lisp_val); > + img->data.lisp_val = Fcons (Qextension_data, > + Fcons (Fnreverse (img->data.lisp_val), > + Qnil)); > } > if (gif->ImageCount > 1) > img->data.lisp_val = Fcons (Qcount, > @@ -8403,6 +8405,8 @@ (at your option) any later version. > > Qcount = intern_c_string ("count"); > staticpro (&Qcount); > + Qextension_data = intern_c_string ("extension-data"); > + staticpro (&Qextension_data); > > QCascent = intern_c_string (":ascent"); > staticpro (&QCascent); > @@ -8498,7 +8502,7 @@ (at your option) any later version. > defsubr (&Simage_refresh); > defsubr (&Simage_size); > defsubr (&Simage_mask_p); > - defsubr (&Simage_extension_data); > + defsubr (&Simage_metadata); > > #if GLYPH_DEBUG > defsubr (&Simagep); -- Joakim Verona