emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Scaling of image previews in org-mode
@ 2016-08-03 19:20 Johannes Brauer
  2016-08-03 22:09 ` Giri Prashanth
  2016-08-07 23:16 ` John Kitchin
  0 siblings, 2 replies; 8+ messages in thread
From: Johannes Brauer @ 2016-08-03 19:20 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

Hi!

If I insert a jpg in my org-mode document, I can preview it but not scale its width, like so:

Add the following code to my init.el file:
(setq org-image-actual-width nil)

Then insert this code in my document, where I want the image to appear:
#+ATTR_ORG: :width 20
[[./test.jpg]]

No matter which value I give for the width argument the image appears in the buffer always in its original size.

However, scaling for html export with #+attr_html works fine.

What is going wrong?

(Org-mode version 8.3.4 (8.3.4-99-ga8e4a3-elpa @ /Users/johannes/Library/Preferences/Aquamacs Emacs/Packages/elpa/org-20160704/)

Johannes

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Scaling of image previews in org-mode
  2016-08-03 19:20 Scaling of image previews in org-mode Johannes Brauer
@ 2016-08-03 22:09 ` Giri Prashanth
  2016-08-04  8:26   ` Johannes Brauer
  2016-08-07 23:16 ` John Kitchin
  1 sibling, 1 reply; 8+ messages in thread
From: Giri Prashanth @ 2016-08-03 22:09 UTC (permalink / raw)
  Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 849 bytes --]

I think you need to build emacs with ImageMagick support for image scaling
to work.


On Wed, Aug 3, 2016 at 12:20 PM, Johannes Brauer <brauer@nordakademie.de>
wrote:

> Hi!
>
> If I insert a jpg in my org-mode document, I can preview it but not scale
> its width, like so:
>
> Add the following code to my init.el file:
> (setq org-image-actual-width nil)
>
> Then insert this code in my document, where I want the image to appear:
> #+ATTR_ORG: :width 20
> [[./test.jpg]]
>
> No matter which value I give for the width argument the image appears in
> the buffer always in its original size.
>
> However, scaling for html export with #+attr_html works fine.
>
> What is going wrong?
>
> (Org-mode version 8.3.4 (8.3.4-99-ga8e4a3-elpa @
> /Users/johannes/Library/Preferences/Aquamacs
> Emacs/Packages/elpa/org-20160704/)
>
> Johannes
>



-- 
-giri

[-- Attachment #2: Type: text/html, Size: 1496 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Scaling of image previews in org-mode
  2016-08-03 22:09 ` Giri Prashanth
@ 2016-08-04  8:26   ` Johannes Brauer
  2016-08-04 16:53     ` Giri Prashanth
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Brauer @ 2016-08-04  8:26 UTC (permalink / raw)
  To: Giri Prashanth; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1053 bytes --]

I think my Aquamacs 3.2 GNU Emacs 24.4.51.2 has got ImageMagick support.

Am 04.08.2016 um 00:09 schrieb Giri Prashanth <giri.prashanth@gmail.com<mailto:giri.prashanth@gmail.com>>:

I think you need to build emacs with ImageMagick support for image scaling to work.


On Wed, Aug 3, 2016 at 12:20 PM, Johannes Brauer <brauer@nordakademie.de<mailto:brauer@nordakademie.de>> wrote:
Hi!

If I insert a jpg in my org-mode document, I can preview it but not scale its width, like so:

Add the following code to my init.el file:
(setq org-image-actual-width nil)

Then insert this code in my document, where I want the image to appear:
#+ATTR_ORG: :width 20
[[./test.jpg]]

No matter which value I give for the width argument the image appears in the buffer always in its original size.

However, scaling for html export with #+attr_html works fine.

What is going wrong?

(Org-mode version 8.3.4 (8.3.4-99-ga8e4a3-elpa @ /Users/johannes/Library/Preferences/Aquamacs Emacs/Packages/elpa/org-20160704/)

Johannes



--
-giri


[-- Attachment #2: Type: text/html, Size: 2502 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Scaling of image previews in org-mode
  2016-08-04  8:26   ` Johannes Brauer
@ 2016-08-04 16:53     ` Giri Prashanth
  0 siblings, 0 replies; 8+ messages in thread
From: Giri Prashanth @ 2016-08-04 16:53 UTC (permalink / raw)
  To: Johannes Brauer; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1286 bytes --]

The following attribute worked for me to scale image:
#+attr_html: :width 100px

But I had to build emacs25 in OS X  with ImageMagick support.

On Thu, Aug 4, 2016 at 1:26 AM, Johannes Brauer <brauer@nordakademie.de>
wrote:

> I think my Aquamacs 3.2 GNU Emacs 24.4.51.2 has got ImageMagick support.
>
> Am 04.08.2016 um 00:09 schrieb Giri Prashanth <giri.prashanth@gmail.com>:
>
> I think you need to build emacs with ImageMagick support for image
> scaling to work.
>
>
> On Wed, Aug 3, 2016 at 12:20 PM, Johannes Brauer <brauer@nordakademie.de>
> wrote:
>
>> Hi!
>>
>> If I insert a jpg in my org-mode document, I can preview it but not scale
>> its width, like so:
>>
>> Add the following code to my init.el file:
>> (setq org-image-actual-width nil)
>>
>> Then insert this code in my document, where I want the image to appear:
>> #+ATTR_ORG: :width 20
>> [[./test.jpg]]
>>
>> No matter which value I give for the width argument the image appears in
>> the buffer always in its original size.
>>
>> However, scaling for html export with #+attr_html works fine.
>>
>> What is going wrong?
>>
>> (Org-mode version 8.3.4 (8.3.4-99-ga8e4a3-elpa @ /Users/johannes/Library/Preferences/Aquamacs
>> Emacs/Packages/elpa/org-20160704/)
>>
>> Johannes
>>
>
>
>
> --
> -giri
>
>
>


-- 
-giri

[-- Attachment #2: Type: text/html, Size: 2600 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Scaling of image previews in org-mode
  2016-08-03 19:20 Scaling of image previews in org-mode Johannes Brauer
  2016-08-03 22:09 ` Giri Prashanth
@ 2016-08-07 23:16 ` John Kitchin
  2016-08-09 17:22   ` Johannes Brauer
  2016-08-10  8:11   ` Uwe Brauer
  1 sibling, 2 replies; 8+ messages in thread
From: John Kitchin @ 2016-08-07 23:16 UTC (permalink / raw)
  To: Johannes Brauer; +Cc: emacs-orgmode@gnu.org

I use this code here:
https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L957

to provide inline scaling in Emacs when it is not built with imagemagick.

Johannes Brauer writes:

> Hi!
>
> If I insert a jpg in my org-mode document, I can preview it but not scale its width, like so:
>
> Add the following code to my init.el file:
> (setq org-image-actual-width nil)
>
> Then insert this code in my document, where I want the image to appear:
> #+ATTR_ORG: :width 20
> [[./test.jpg]]
>
> No matter which value I give for the width argument the image appears in the buffer always in its original size.
>
> However, scaling for html export with #+attr_html works fine.

Export is not the same as the inline scaling. I am not sure what happens
with export, but the browser may be doing the scaling.

>
> What is going wrong?
>
> (Org-mode version 8.3.4 (8.3.4-99-ga8e4a3-elpa @ /Users/johannes/Library/Preferences/Aquamacs Emacs/Packages/elpa/org-20160704/)
>
> Johannes


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Scaling of image previews in org-mode
  2016-08-07 23:16 ` John Kitchin
@ 2016-08-09 17:22   ` Johannes Brauer
  2016-08-10  8:11   ` Uwe Brauer
  1 sibling, 0 replies; 8+ messages in thread
From: Johannes Brauer @ 2016-08-09 17:22 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode@gnu.org

thank you for the hint, I will give it a try

Johannes

> Am 08.08.2016 um 01:16 schrieb John Kitchin <jkitchin@andrew.cmu.edu>:
> 
> I use this code here:
> https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L957
> 
> to provide inline scaling in Emacs when it is not built with imagemagick.
> 
> Johannes Brauer writes:
> 
>> Hi!
>> 
>> If I insert a jpg in my org-mode document, I can preview it but not scale its width, like so:
>> 
>> Add the following code to my init.el file:
>> (setq org-image-actual-width nil)
>> 
>> Then insert this code in my document, where I want the image to appear:
>> #+ATTR_ORG: :width 20
>> [[./test.jpg]]
>> 
>> No matter which value I give for the width argument the image appears in the buffer always in its original size.
>> 
>> However, scaling for html export with #+attr_html works fine.
> 
> Export is not the same as the inline scaling. I am not sure what happens
> with export, but the browser may be doing the scaling.
> 
>> 
>> What is going wrong?
>> 
>> (Org-mode version 8.3.4 (8.3.4-99-ga8e4a3-elpa @ /Users/johannes/Library/Preferences/Aquamacs Emacs/Packages/elpa/org-20160704/)
>> 
>> Johannes
> 
> 
> -- 
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Scaling of image previews in org-mode
  2016-08-07 23:16 ` John Kitchin
  2016-08-09 17:22   ` Johannes Brauer
@ 2016-08-10  8:11   ` Uwe Brauer
  2016-08-10 14:44     ` John Kitchin
  1 sibling, 1 reply; 8+ messages in thread
From: Uwe Brauer @ 2016-08-10  8:11 UTC (permalink / raw)
  To: emacs-orgmode

>>> "John" == John Kitchin <jkitchin@andrew.cmu.edu> writes:

   > I use this code here:
   > https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L957

   > to provide inline scaling in Emacs when it is not built with imagemagick.

Hi

Could that package or parts of it also be used in other modes?

I have the problem of displaying images in latex buffers (using auctex)

The only available tool I know is iimage.el, but this package does not
allow to re-seize the displayed image. I asked about it on emacs devel
and the answer was: «please send a patch or wait», fail enough

I just attach the mail in question below in order to clarify.

,----
| 
| 
| 
| I just learnt about iimage.el, which is now part of GNU emacs core. I
| like it quite a lot, the only thing which I find a bit inconvenient on
| my 12 inch Laptop is the size of the images displayed. I did not find
| any variable in which the size of images could be changed.
| 
| 
| The author's address does not work anymore, so I looked at the code it
| seems that the essential part is this:
| 
|   (if arg
|                   (add-text-properties (match-beginning 0) (match-end 0)
|                                        `(display ,(create-image file)
|                                                   ^^^^^
|                                          modification-hooks
|                                          (iimage-modification-hook)))
|             
| 
| Now I checked that function and its documentation says
| ,----
| [+]
| | 
| | create-image is an autoloaded compiled Lisp function in ‘image.el’.
| | (create-image FILE-OR-DATA &optional TYPE DATA-P &rest PROPS)
| | Create an image.
| | ....
| | Images should not be larger than specified by ‘max-image-size’.
| `----
| 
| 
| However 
| ,----
| [+]
| | max-image-size is a variable defined in ‘C source code’.
| | Its value is 10.0
| `----
| 
| So I cannot change that value easily. Anybody has an idea how to change
| the size of the displayed images?
| 
| thanks
| 
| Uwe Brauer 
| 
`----

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Scaling of image previews in org-mode
  2016-08-10  8:11   ` Uwe Brauer
@ 2016-08-10 14:44     ` John Kitchin
  0 siblings, 0 replies; 8+ messages in thread
From: John Kitchin @ 2016-08-10 14:44 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode

Certainly it could be adapted to other modes, at least for showing the
images. If there was a way to parse resizing info, or set it via
variables, you could also get resized images. The key is hooking into
font-lock and detecting where images are. 

The basic framework is laid out here:

http://kitchingroup.cheme.cmu.edu/blog/2016/03/21/Displaying-image-overlays-on-image-filenames-in-Emacs/

That example had imagemagick compiled in, but it could be adapted pretty
readily to use an external imagemagick..


Uwe Brauer writes:

>>>> "John" == John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
>    > I use this code here:
>    > https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L957
>
>    > to provide inline scaling in Emacs when it is not built with imagemagick.
>
> Hi
>
> Could that package or parts of it also be used in other modes?
>
> I have the problem of displaying images in latex buffers (using auctex)
>
> The only available tool I know is iimage.el, but this package does not
> allow to re-seize the displayed image. I asked about it on emacs devel
> and the answer was: «please send a patch or wait», fail enough
>
> I just attach the mail in question below in order to clarify.
>
> ,----
> | 
> | 
> | 
> | I just learnt about iimage.el, which is now part of GNU emacs core. I
> | like it quite a lot, the only thing which I find a bit inconvenient on
> | my 12 inch Laptop is the size of the images displayed. I did not find
> | any variable in which the size of images could be changed.
> | 
> | 
> | The author's address does not work anymore, so I looked at the code it
> | seems that the essential part is this:
> | 
> |   (if arg
> |                   (add-text-properties (match-beginning 0) (match-end 0)
> |                                        `(display ,(create-image file)
> |                                                   ^^^^^
> |                                          modification-hooks
> |                                          (iimage-modification-hook)))
> |             
> | 
> | Now I checked that function and its documentation says
> | ,----
> | [+]
> | | 
> | | create-image is an autoloaded compiled Lisp function in ‘image.el’.
> | | (create-image FILE-OR-DATA &optional TYPE DATA-P &rest PROPS)
> | | Create an image.
> | | ....
> | | Images should not be larger than specified by ‘max-image-size’.
> | `----
> | 
> | 
> | However 
> | ,----
> | [+]
> | | max-image-size is a variable defined in ‘C source code’.
> | | Its value is 10.0
> | `----
> | 
> | So I cannot change that value easily. Anybody has an idea how to change
> | the size of the displayed images?
> | 
> | thanks
> | 
> | Uwe Brauer 
> | 
> `----


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-08-10 14:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-03 19:20 Scaling of image previews in org-mode Johannes Brauer
2016-08-03 22:09 ` Giri Prashanth
2016-08-04  8:26   ` Johannes Brauer
2016-08-04 16:53     ` Giri Prashanth
2016-08-07 23:16 ` John Kitchin
2016-08-09 17:22   ` Johannes Brauer
2016-08-10  8:11   ` Uwe Brauer
2016-08-10 14:44     ` John Kitchin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).