GNU bug report logs -
#38310
27.0.50; (image-convert "data" t) doesn't work
Previous Next
Reported by: Katsumi Yamaoka <yamaoka <at> jpl.org>
Date: Thu, 21 Nov 2019 07:14:02 UTC
Severity: normal
Tags: fixed
Found in version 27.0.50
Fixed in version 27.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38310 in the body.
You can then email your comments to 38310 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#38310
; Package
emacs
.
(Thu, 21 Nov 2019 07:14:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Katsumi Yamaoka <yamaoka <at> jpl.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 21 Nov 2019 07:14:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi,
Whereas (image-convert "file") works, (image-convert "data" t)
causes an error as follows:
(let ((image-converter 'graphicsmagick))
(image-convert "data" t))
=>
image-convert: /usr/bin/gm convert: Unable to open file (-) [No such file or directory].
(let ((image-converter 'imagemagick))
(image-convert "data" t))
=>
image-convert: convert: unable to open image `nil:-': No such file or directory @ error/blob.c/OpenBlob/2873.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/560.
convert: no images defined `png:-' @ error/convert.c/ConvertImageCommand/3258.
Where "data" is a binary string of a webp image gotten from:
<https://www.gstatic.com/webp/gallery/1.sm.webp>
Is a temp file required instead of stdin to those converters?
In relation to this, I think `image-convert' should be autoloaded
for the case where `(create-image FILE-OR-DATA 'image-convert)'
is called from a program other than `find-file'.
Thanks.
Regards,
$ gm -version
GraphicsMagick 1.3.33 2019-07-20 Q16 http://www.GraphicsMagick.org/
$ convert -version
ImageMagick 6.9.10-11 Q16 x86_64 2018-09-08 https://www.imagemagick.org
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#38310
; Package
emacs
.
(Thu, 21 Nov 2019 12:56:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 38310 <at> debbugs.gnu.org (full text, mbox):
Katsumi Yamaoka <yamaoka <at> jpl.org> writes:
> Whereas (image-convert "file") works, (image-convert "data" t)
> causes an error as follows:
>
> (let ((image-converter 'graphicsmagick))
> (image-convert "data" t))
> =>
> image-convert: /usr/bin/gm convert: Unable to open file (-) [No such
> file or directory].
Yeah, but that's not a valid call format. As the doc string says
---
If IMAGE-FORMAT is non-nil, IMAGE is a string containing the
image data, and IMAGE-FORMAT is a symbol with a MIME format name
like "image/webp".
---
So you have to say
(image-convert "data" 'image/webp)
I'll rephrase the doc string, because it's not very well-written.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#38310
; Package
emacs
.
(Thu, 21 Nov 2019 13:03:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 38310 <at> debbugs.gnu.org (full text, mbox):
Katsumi Yamaoka <yamaoka <at> jpl.org> writes:
> In relation to this, I think `image-convert' should be auto loaded
> for the case where `(create-image FILE-OR-DATA 'image-convert)'
> is called from a program other than `find-file'.
Yup; should now be fixed on the trunk.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) fixed.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 21 Nov 2019 13:03:03 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 27.1, send any further explanations to
38310 <at> debbugs.gnu.org and Katsumi Yamaoka <yamaoka <at> jpl.org>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 21 Nov 2019 13:03:03 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#38310
; Package
emacs
.
(Fri, 22 Nov 2019 00:03:02 GMT)
Full text and
rfc822 format available.
Message #18 received at 38310 <at> debbugs.gnu.org (full text, mbox):
On Thu, 21 Nov 2019 13:55:48 +0100, Lars Ingebrigtsen wrote:
> So you have to say
> (image-convert "data" 'image/webp)
> I'll rephrase the doc string, because it's not very well-written.
Ah, thanks. I verified both these tests work with Emacs -Q.
(with-current-buffer
(url-retrieve-synchronously
"https://www.gstatic.com/webp/gallery/1.sm.webp")
(goto-char (point-min))
(search-forward "\n\n")
(image-convert (buffer-substring (point) (point-max)) 'image/webp))
(with-current-buffer
(url-retrieve-synchronously
"https://www.gstatic.com/webp/gallery/1.sm.webp")
(goto-char (point-min))
(search-forward "\n\n")
(create-image (buffer-substring (point) (point-max)) 'image-convert
t :format 'image/webp))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#38310
; Package
emacs
.
(Fri, 22 Nov 2019 12:18:01 GMT)
Full text and
rfc822 format available.
Message #21 received at 38310 <at> debbugs.gnu.org (full text, mbox):
Katsumi Yamaoka <yamaoka <at> jpl.org> writes:
> Ah, thanks. I verified both these tests work with Emacs -Q.
>
> (with-current-buffer
> (url-retrieve-synchronously
> "https://www.gstatic.com/webp/gallery/1.sm.webp")
> (goto-char (point-min))
> (search-forward "\n\n")
> (image-convert (buffer-substring (point) (point-max)) 'image/webp))
Perhaps image-convert should signal an explicit error if the second
parameter isn't on the proper format?
I've now added some better error feedback on the trunk.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#38310
; Package
emacs
.
(Mon, 25 Nov 2019 23:41:02 GMT)
Full text and
rfc822 format available.
Message #24 received at 38310 <at> debbugs.gnu.org (full text, mbox):
On Fri, 22 Nov 2019 13:16:11 +0100, Lars Ingebrigtsen wrote:
> Perhaps image-convert should signal an explicit error if the second
> parameter isn't on the proper format?
> I've now added some better error feedback on the trunk.
It looks useful for people like me. Thanks.
I think it would be better if we can see what types are available
to convert before trying to convert no matter whether ImageMagick
is built-in. The default value for `imagemagick-enabled-types'
looks old as it does not contain at least WEBP, and there is no
such one that can be used for GraphicsMagick.
The goal might be to make it enable a programmer to do this
without considering whether conversion is necessary or not:
(let ((type "image/webp"))
(if (image-type-displayable-p type)
(create-image "file-or-data" type nil-or-t)))
Regards,
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#38310
; Package
emacs
.
(Wed, 27 Nov 2019 12:05:01 GMT)
Full text and
rfc822 format available.
Message #27 received at 38310 <at> debbugs.gnu.org (full text, mbox):
Katsumi Yamaoka <yamaoka <at> jpl.org> writes:
> The goal might be to make it enable a programmer to do this
> without considering whether conversion is necessary or not:
>
> (let ((type "image/webp"))
> (if (image-type-displayable-p type)
> (create-image "file-or-data" type nil-or-t)))
Yes, that would be nice. But you can almost do that with just
(ignore-errors (create-image file))
:-)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 25 Dec 2019 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 118 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.