* Image rescaling
@ 2014-09-15 12:45 Lars Magne Ingebrigtsen
2014-09-15 12:55 ` joakim
` (3 more replies)
0 siblings, 4 replies; 21+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-09-15 12:45 UTC (permalink / raw
To: emacs-devel
Most of the image format decoders (jpeg and gif, for instance) do not
support image rescaling. So shr uses ImageMagick for all its image
handling.
There are two problems with this:
1) ImageMagick is crashy. Virtually all Emacs crashes I get happen deep
in the ImageMagic code. I mean, I don't get a lot of crashes, but they
happen from time to time, and are pretty annoying.
2) Some people run Emacs without ImageMagick built in, but usually have
the other libraries enabled.
So I would propose to add a general image scaling function, and use that
in all the image handling functions. Without image rescaling, Emacs is
pretty useless for anything that involves handling images.
Does this sound OK to everybody?
And if so, is there an FSF-copyright-assigned quality image rescaling
function out there that I could adapt to Emacs so that I don't have to
write it myself? >"?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Image rescaling
2014-09-15 12:45 Image rescaling Lars Magne Ingebrigtsen
@ 2014-09-15 12:55 ` joakim
2014-09-15 13:03 ` Lars Magne Ingebrigtsen
2014-09-15 15:12 ` joakim
2014-09-16 0:07 ` Stefan Monnier
` (2 subsequent siblings)
3 siblings, 2 replies; 21+ messages in thread
From: joakim @ 2014-09-15 12:55 UTC (permalink / raw
To: emacs-devel
Lars Magne Ingebrigtsen <larsi@gnus.org> writes:
> Most of the image format decoders (jpeg and gif, for instance) do not
> support image rescaling. So shr uses ImageMagick for all its image
> handling.
>
> There are two problems with this:
>
> 1) ImageMagick is crashy. Virtually all Emacs crashes I get happen deep
> in the ImageMagic code. I mean, I don't get a lot of crashes, but they
> happen from time to time, and are pretty annoying.
>
> 2) Some people run Emacs without ImageMagick built in, but usually have
> the other libraries enabled.
>
> So I would propose to add a general image scaling function, and use that
> in all the image handling functions. Without image rescaling, Emacs is
> pretty useless for anything that involves handling images.
>
> Does this sound OK to everybody?
>
> And if so, is there an FSF-copyright-assigned quality image rescaling
> function out there that I could adapt to Emacs so that I don't have to
> write it myself? >"?
Its a pity ImageMagic is crashy, but I take your word for it, since i
dont experience it myself.
Maybe something can be extracted from Gimp or Inkscape?
Other than that, implementing a schoolbook image rescaling algorithm
shouldnt be too much work.
--
Joakim Verona
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Image rescaling
2014-09-15 12:55 ` joakim
@ 2014-09-15 13:03 ` Lars Magne Ingebrigtsen
2014-09-15 14:27 ` Stefan Monnier
[not found] ` <COL131-W90F448E3DC24C8E66A0E4D84C90@phx.gbl>
2014-09-15 15:12 ` joakim
1 sibling, 2 replies; 21+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-09-15 13:03 UTC (permalink / raw
To: joakim; +Cc: emacs-devel
joakim@verona.se writes:
> Other than that, implementing a schoolbook image rescaling algorithm
> shouldnt be too much work.
Rescaling is apparently a pretty tricky thing that is mostly implemented
wrong:
http://www.4p8.com/eric.brasseur/gamma.html
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Image rescaling
2014-09-15 12:55 ` joakim
2014-09-15 13:03 ` Lars Magne Ingebrigtsen
@ 2014-09-15 15:12 ` joakim
2014-09-15 16:14 ` Lars Magne Ingebrigtsen
1 sibling, 1 reply; 21+ messages in thread
From: joakim @ 2014-09-15 15:12 UTC (permalink / raw
To: emacs-devel
joakim@verona.se writes:
> Lars Magne Ingebrigtsen <larsi@gnus.org> writes:
>
>> Most of the image format decoders (jpeg and gif, for instance) do not
>> support image rescaling. So shr uses ImageMagick for all its image
>> handling.
>>
>> There are two problems with this:
>>
>> 1) ImageMagick is crashy. Virtually all Emacs crashes I get happen deep
>> in the ImageMagic code. I mean, I don't get a lot of crashes, but they
>> happen from time to time, and are pretty annoying.
>>
>> 2) Some people run Emacs without ImageMagick built in, but usually have
>> the other libraries enabled.
>>
>> So I would propose to add a general image scaling function, and use that
>> in all the image handling functions. Without image rescaling, Emacs is
>> pretty useless for anything that involves handling images.
>>
>> Does this sound OK to everybody?
>>
>> And if so, is there an FSF-copyright-assigned quality image rescaling
>> function out there that I could adapt to Emacs so that I don't have to
>> write it myself? >"?
>
> Its a pity ImageMagic is crashy, but I take your word for it, since i
> dont experience it myself.
>
> Maybe something can be extracted from Gimp or Inkscape?
> Other than that, implementing a schoolbook image rescaling algorithm
> shouldnt be too much work.
OpenCV could perhaps be used as well. I have used it for mixing and
scaling of videostreams in the past, using affine transformations.
I have used GStreamer as well, but I dont know how good that is for
still image scaling.
Maybe the above libraries are too heavyweight, I'm just throwing the
ideas out there.
--
Joakim Verona
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Image rescaling
2014-09-15 15:12 ` joakim
@ 2014-09-15 16:14 ` Lars Magne Ingebrigtsen
2014-09-15 19:01 ` joakim
0 siblings, 1 reply; 21+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-09-15 16:14 UTC (permalink / raw
To: joakim; +Cc: emacs-devel
joakim@verona.se writes:
> I have used GStreamer as well, but I dont know how good that is for
> still image scaling.
>
> Maybe the above libraries are too heavyweight, I'm just throwing the
> ideas out there.
I was thinking that image rescaling wouldn't be, like, more than a
hundred lines of C code. So no libraries at all; just some more code in
image.c.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Image rescaling
2014-09-15 16:14 ` Lars Magne Ingebrigtsen
@ 2014-09-15 19:01 ` joakim
2014-09-15 19:59 ` Lars Magne Ingebrigtsen
0 siblings, 1 reply; 21+ messages in thread
From: joakim @ 2014-09-15 19:01 UTC (permalink / raw
To: Lars Magne Ingebrigtsen; +Cc: emacs-devel
Lars Magne Ingebrigtsen <larsi@gnus.org> writes:
> joakim@verona.se writes:
>
>> I have used GStreamer as well, but I dont know how good that is for
>> still image scaling.
>>
>> Maybe the above libraries are too heavyweight, I'm just throwing the
>> ideas out there.
>
> I was thinking that image rescaling wouldn't be, like, more than a
> hundred lines of C code. So no libraries at all; just some more code in
> image.c.
Maybe fallback to nearest neighbour if one doesnt have/want imagemagic?
Thats maybe, uhm, 10 lines of code?
--
Joakim Verona
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Image rescaling
2014-09-15 12:45 Image rescaling Lars Magne Ingebrigtsen
2014-09-15 12:55 ` joakim
@ 2014-09-16 0:07 ` Stefan Monnier
2014-09-16 9:42 ` Lars Magne Ingebrigtsen
2014-09-16 3:10 ` Stephen J. Turnbull
2014-09-19 16:48 ` Ivan Kanis
3 siblings, 1 reply; 21+ messages in thread
From: Stefan Monnier @ 2014-09-16 0:07 UTC (permalink / raw
To: emacs-devel
> 1) ImageMagick is crashy. Virtually all Emacs crashes I get happen deep
> in the ImageMagic code. I mean, I don't get a lot of crashes, but they
> happen from time to time, and are pretty annoying.
WIBNI we could fix those?
> Does this sound OK to everybody?
I'm not super-excited at the prospect, but I could probably live with it.
Stefan
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Image rescaling
2014-09-16 0:07 ` Stefan Monnier
@ 2014-09-16 9:42 ` Lars Magne Ingebrigtsen
2014-09-16 11:22 ` Dmitry Antipov
0 siblings, 1 reply; 21+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-09-16 9:42 UTC (permalink / raw
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> 1) ImageMagick is crashy. Virtually all Emacs crashes I get happen deep
>> in the ImageMagic code. I mean, I don't get a lot of crashes, but they
>> happen from time to time, and are pretty annoying.
>
> WIBNI we could fix those?
It would be, but I don't really want to become an ImageMagick
developer. >"?
>> Does this sound OK to everybody?
>
> I'm not super-excited at the prospect, but I could probably live with it.
Ok, I'll start looking at algorithms...
But if somebody else wants to implement this, please do be my guest.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Image rescaling
2014-09-16 9:42 ` Lars Magne Ingebrigtsen
@ 2014-09-16 11:22 ` Dmitry Antipov
2014-09-16 11:37 ` Lars Magne Ingebrigtsen
0 siblings, 1 reply; 21+ messages in thread
From: Dmitry Antipov @ 2014-09-16 11:22 UTC (permalink / raw
To: Lars Magne Ingebrigtsen; +Cc: Stefan Monnier, emacs-devel
On 09/16/2014 01:42 PM, Lars Magne Ingebrigtsen wrote:
> Ok, I'll start looking at algorithms...
>
> But if somebody else wants to implement this, please do be my guest.
If USE_GTK, why do not rely on gdk_pixbuf_scale?
Dmitry
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Image rescaling
2014-09-16 11:22 ` Dmitry Antipov
@ 2014-09-16 11:37 ` Lars Magne Ingebrigtsen
2014-09-16 14:42 ` Eli Zaretskii
0 siblings, 1 reply; 21+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-09-16 11:37 UTC (permalink / raw
To: Dmitry Antipov; +Cc: Stefan Monnier, emacs-devel
Dmitry Antipov <dmantipov@yandex.ru> writes:
> If USE_GTK, why do not rely on gdk_pixbuf_scale?
Not all Emacsen er built with GTK, I think.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Image rescaling
2014-09-16 11:37 ` Lars Magne Ingebrigtsen
@ 2014-09-16 14:42 ` Eli Zaretskii
2014-09-16 14:52 ` Lars Magne Ingebrigtsen
0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2014-09-16 14:42 UTC (permalink / raw
To: Lars Magne Ingebrigtsen; +Cc: dmantipov, monnier, emacs-devel
> From: Lars Magne Ingebrigtsen <larsi@gnus.org>
> Date: Tue, 16 Sep 2014 13:37:21 +0200
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
>
> Dmitry Antipov <dmantipov@yandex.ru> writes:
>
> > If USE_GTK, why do not rely on gdk_pixbuf_scale?
>
> Not all Emacsen er built with GTK, I think.
Well, not all Emacsen are built with ImageMagick, either, but you were
okay with depending on it, if it wasn't for its crashing.
The gdbk-pixbuf library is also available in Emacs build with RSVG
support, and we even already have code to make an image out of
GdkPixbuf objects in that case. So I think Dmitry's suggestion is not
something to dismiss too easily.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Image rescaling
2014-09-16 14:42 ` Eli Zaretskii
@ 2014-09-16 14:52 ` Lars Magne Ingebrigtsen
0 siblings, 0 replies; 21+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-09-16 14:52 UTC (permalink / raw
To: Eli Zaretskii; +Cc: dmantipov, monnier, emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
> Well, not all Emacsen are built with ImageMagick, either, but you were
> okay with depending on it, if it wasn't for its crashing.
Well, I wasn't going to reimplement all of ImageMagick in Emacs, either,
so it's not really a fair comparison.
After looking at the algorithms, I think we may be talking about less
than 50 lines of C code vs relying on an external library not available
in all builds.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 21+ messages in thread
* Image rescaling
2014-09-15 12:45 Image rescaling Lars Magne Ingebrigtsen
2014-09-15 12:55 ` joakim
2014-09-16 0:07 ` Stefan Monnier
@ 2014-09-16 3:10 ` Stephen J. Turnbull
2014-09-16 14:33 ` Eli Zaretskii
2014-09-19 16:48 ` Ivan Kanis
3 siblings, 1 reply; 21+ messages in thread
From: Stephen J. Turnbull @ 2014-09-16 3:10 UTC (permalink / raw
To: Lars Magne Ingebrigtsen; +Cc: emacs-devel
Lars Magne Ingebrigtsen writes:
> 1) ImageMagick is crashy. Virtually all Emacs crashes I get happen deep
> in the ImageMagic code. I mean, I don't get a lot of crashes, but they
> happen from time to time, and are pretty annoying.
That's a shame. That's why we gave up on delegating image support to
ImageMagick in 1999 (or maybe a year or two later).
Has anybody tried GraphicsMagick for image support in Emacs (assuming
it's not somehow taboo for political reasons)? Their original reason
for forking was to provide a more stable API and implementation.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Image rescaling
2014-09-15 12:45 Image rescaling Lars Magne Ingebrigtsen
` (2 preceding siblings ...)
2014-09-16 3:10 ` Stephen J. Turnbull
@ 2014-09-19 16:48 ` Ivan Kanis
2014-09-30 14:19 ` Lars Magne Ingebrigtsen
3 siblings, 1 reply; 21+ messages in thread
From: Ivan Kanis @ 2014-09-19 16:48 UTC (permalink / raw
To: emacs-devel
September, 15 at 14:45 Lars Magne Ingebrigtsen wrote:
> Most of the image format decoders (jpeg and gif, for instance) do not
> support image rescaling. So shr uses ImageMagick for all its image
> handling.
Could you fix image orientation while you are at it? I have gotten a few
e-mail in gnus with images upside down. They were taken with smart phones
and the image orientation information is in the jpeg.
You can see the command jpegexiforient in Linux for more information.
Ivan
--
The rubber band broke.
-- BOFH excuse #4
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2014-09-30 14:19 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-15 12:45 Image rescaling Lars Magne Ingebrigtsen
2014-09-15 12:55 ` joakim
2014-09-15 13:03 ` Lars Magne Ingebrigtsen
2014-09-15 14:27 ` Stefan Monnier
2014-09-15 15:13 ` David Kastrup
[not found] ` <COL131-W90F448E3DC24C8E66A0E4D84C90@phx.gbl>
[not found] ` <m3d2as98w1.fsf@stories.gnus.org>
2014-09-18 17:03 ` Mirek Kaim
2014-09-15 15:12 ` joakim
2014-09-15 16:14 ` Lars Magne Ingebrigtsen
2014-09-15 19:01 ` joakim
2014-09-15 19:59 ` Lars Magne Ingebrigtsen
2014-09-15 20:00 ` joakim
2014-09-16 0:07 ` Stefan Monnier
2014-09-16 9:42 ` Lars Magne Ingebrigtsen
2014-09-16 11:22 ` Dmitry Antipov
2014-09-16 11:37 ` Lars Magne Ingebrigtsen
2014-09-16 14:42 ` Eli Zaretskii
2014-09-16 14:52 ` Lars Magne Ingebrigtsen
2014-09-16 3:10 ` Stephen J. Turnbull
2014-09-16 14:33 ` Eli Zaretskii
2014-09-19 16:48 ` Ivan Kanis
2014-09-30 14:19 ` Lars Magne Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.