emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: yank-media: allow users to limit image types that can be inserted


From: pinmacs
Subject: Re: yank-media: allow users to limit image types that can be inserted
Date: Mon, 23 Sep 2024 15:00:54 -0300

Before yank-media, I was using org-download [1], so I got used to just insert a screenshot with no question to answer (such as the type of the image).

Recently, I moved to yank-media, but to have the same functionality, I had to tweak it a little bit, full detail here [2].

I see utility on asking for the image/png and image/jpeg and here you have details why you would care about [3]. But I am not familiar with image/pbm, image/xbm, image/xpm, image/tiff; for me, it is a nonsense to appear as types to select. But maybe somebody wants them, so that's why an option to pre-filter (or not) the candidates; and also the option to just stick with png (and save a keystroke, and a nonrelevant decision).

[1] https://github.com/abo-abo/org-download

[2] https://mail.gnu.org/archive/html/emacs-orgmode/2024-09/msg00209.html

[3]

  > The JPEG compression algorithm operates at its best on photographs
  > and paintings of realistic scenes with smooth variations of tone
  > and color (...) However, JPEG is not well suited for line drawings
  > and other textual or iconic graphics, where the sharp contrasts
  > between adjacent pixels can cause noticeable artifacts. Such
  > images are better saved in a lossless graphics format such as
  > TIFF, GIF, PNG, or a raw image format. The JPEG standard includes
  > a lossless coding mode, but that mode is not supported in most
  > products.

  https://en.wikipedia.org/wiki/JPEG#Typical_use

  > The JPEG (Joint Photographic Experts Group) format can produce a
  > smaller file than PNG for photographic (and photo-like) images,
  > since JPEG uses a lossy encoding method specifically designed for
  > photographic image data, which is typically dominated by soft,
  > low-contrast transitions, and an amount of noise or similar
  > irregular structures. Using PNG instead of a high-quality JPEG for
  > such images would result in a large increase in file size with
  > negligible gain in quality. In comparison, when storing images
  > that contain text, line art, or graphics – images with sharp
  > transitions and large areas of solid color – the PNG format can
  > compress image data more than JPEG can. Additionally, PNG is
  > lossless, while JPEG produces visual artifacts around
  > high-contrast areas.

  https://en.wikipedia.org/wiki/PNG#JPEG

On 2024-09-23 13:34, Eli Zaretskii wrote:
From: Robert Pluim <rpluim@gmail.com>
Cc: visuweshm@gmail.com,  pinmacs@cas.cat,  emacs-devel@gnu.org
Date: Mon, 23 Sep 2024 18:10:43 +0200

On Mon, 23 Sep 2024 18:54:25 +0300, Eli Zaretskii <eliz@gnu.org> said:
     >> From: Robert Pluim <rpluim@gmail.com>
     >> Cc: Visuwesh <visuweshm@gmail.com>,  pinmacs@cas.cat,  
emacs-devel@gnu.org
     >> Date: Mon, 23 Sep 2024 17:09:03 +0200
     >>
     Eli> IMO, for users we already have what is needed: when we detect several
     Eli> formats, we show them to the user and ask him/her to tell us which
     Eli> format he/she wants to use.
     >>
     >> But that requires user interaction. I think the original request could
     >> be summed up as "if the list contains image/png, donʼt ask me, just
     >> insert the image".

     Eli> That's not how I understand the request.  It was not always PNG, it
     Eli> was "sometimes PNG, but if so-and-so-happens, the JPEG" etc.

Yes, but the "so-and-so" is determined by a user option. So

1. Always prefer "png" -> user option == "png"
2. Want to choose between "png" and "jpeg" -> user option == ("png"
"jpeg")
3. All of the formats -> user option == nil
That makes little sense to me: how can the user decide in advance to
use only PNG? by what logic?

And anyway, this is not what the OP said.  Let's get back to what he
said:

     Eli> And no one has explained yet why I would prefer PNG to JPEG or vice
     Eli> versa, btw.  The usual choices I'm familiar with is whether or not to
     Eli> preserve typefaces, colors, and other fancy attributes; regarding
     Eli> images, there's just a decision whether you want to paste the material
     Eli> as a picture or as some kind of text, whether rich or not.  So the
     Eli> background and the context for this request is still not clear to me.

I can definitely see a use for case 1 above: "donʼt bother asking me,
if png is available just use that".
I don't understand why would someone define their preference in the
terms of image format.  It makes no sense.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]