From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: pinmacs Newsgroups: gmane.emacs.devel Subject: Re: yank-media: allow users to limit image types that can be inserted Date: Mon, 23 Sep 2024 15:00:54 -0300 Message-ID: <3a015d0f-549a-401f-be1c-651c9dbd5d9a@cas.cat> References: <79fc91f3-c2c3-44db-9817-595808917f26@cas.cat> <86ed5ahb08.fsf@gnu.org> <87zfnywki8.fsf@gmail.com> <86setqfnmq.fsf@gnu.org> <87frpqflv4.fsf@gmail.com> <86ikumfjri.fsf@gnu.org> <877cb2fj0c.fsf@gmail.com> <86cykufhw7.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5466"; mail-complaints-to="usenet@ciao.gmane.io" Cc: visuweshm@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii , Robert Pluim Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Sep 23 20:02:15 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ssnO3-0001IX-1P for ged-emacs-devel@m.gmane-mx.org; Mon, 23 Sep 2024 20:02:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ssnNJ-0003e5-Ro; Mon, 23 Sep 2024 14:01:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ssnNC-0003Xp-IX for emacs-devel@gnu.org; Mon, 23 Sep 2024 14:01:24 -0400 Original-Received: from cas.cat ([45.150.187.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ssnN9-0002DU-Br; Mon, 23 Sep 2024 14:01:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cas.cat; s=2023; t=1727114466; bh=RzACM8diEelIPQFX/9gnUkSRTEhQMTQ7d/K2ULSh80w=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=bjlHLfqDG/j+QR0L4fK6W0mifjEyBRR23HGjF8hS/o8r7rv5EsYXLJR9ACCLxHhNq vA5F7AaeQaZIEazk1Sfp43uM8CRlfzLhOumsqMKZ6y/szW0RuoAK34I6OQvHNhhRJK DFEsvjGMAdh8bznn9Pwh2pfISwQfx8vHR3AJSU8KTirWwmPx6H5hQG7RLMPTlM6lm+ 89fIzpn/dQUsTT7R1fS7dfTQTgw1mAz934NLitIpXKL9cI5SWVg4V35PakfuW8H8XP s4dOzBFQI3fs2UkbqOkZwzxex6suotxrhDwb5HXAQjb9KMwLrU0n5uBGL9zcu7aw3j iHNYhf70BYXgQ== Content-Language: en-US In-Reply-To: <86cykufhw7.fsf@gnu.org> Received-SPF: pass client-ip=45.150.187.15; envelope-from=pinmacs@cas.cat; helo=cas.cat X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:323985 Archived-At: 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 >> 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 said: >> >> From: Robert Pluim >> >> Cc: Visuwesh , 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. >