public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Images in Jupyter Notebook to Markdown conversion
@ 2021-12-27 10:36 Sébastien Boisgérault
       [not found] ` <6d84aa5d-bdc8-4612-b471-c7b270f3936an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Sébastien Boisgérault @ 2021-12-27 10:36 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1651 bytes --]

Hello everyone,

When i convert the images.ipynb notebook to markdown, the resuting document 
contains

::: {.output .execute_result execution_count="4"}
![](fcbe61351f965c3664d65d5e93991915402e0483.png)
:::

but AFAICT, the png file is not generated. Using the standalone option does 
not change anything. And of course, the round-tripping (md -> ipynb) fails 
with:

File fcbe61351f965c3664d65d5e93991915402e0483.png not found in resource path

The original notebook can be visualized here: 
https://github.com/boisgera/python-advanced-eval/blob/master/samples/images.ipynb. 
The (Grace Hopper) image it contains is an image/png cell output 
(Matplotlib is used to display the image) :

  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": 
"iVBORw0KGgoAAAANSUhEUgAAAgAAAAJYCAIAAACbx8k3AAEAAElEQVR4nGT92dMsWZIfhrn72SIil2+/S9Xtqq7qbboxPSswwGAAGQwkRYEyQgYZARIvMiNIo0wveseDTGaCXkTqX+CLKJO4CRIIgaSGAIfAAAPMYLqnZ+nprurat7t+Wy4RcTZ3PXhGVPYgH67lzS8z4sRZfPn5z93x6tG/7X3jXUA0tWApAgAGbd/vlst 
...

I am using pandoc 2.16.2 (Linux). Is it considered a bug or am I missing 
something? Shall I file an issue? 

Regards,

Sébastien


-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/6d84aa5d-bdc8-4612-b471-c7b270f3936an%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 2260 bytes --]

[-- Attachment #2: images.ipynb --]
[-- Type: application/x-ipynb+json, Size: 613920 bytes --]

[-- Attachment #3: images.md --]
[-- Type: text/markdown, Size: 1840 bytes --]

---
jupyter:
  nbformat: 4
  nbformat_minor: 2
---

::: {.cell .code execution_count="1"}
``` python
import matplotlib.pyplot as plt
from matplotlib.cbook import get_sample_data
```
:::

::: {.cell .code execution_count="2"}
``` python
with get_sample_data("grace_hopper.jpg") as file:
    image_array = plt.imread(file)
```
:::

::: {.cell .code execution_count="3"}
``` python
image_array
```

::: {.output .execute_result execution_count="3"}
    array([[[ 21,  24,  77],
            [ 27,  30,  85],
            [ 33,  35,  92],
            ...,
            [ 76, 114, 189],
            [ 71, 109, 184],
            [ 76, 114, 189]],

           [[ 26,  29,  82],
            [ 25,  28,  83],
            [ 27,  29,  86],
            ...,
            [ 60,  98, 173],
            [ 56,  94, 169],
            [ 62, 100, 175]],

           [[ 21,  24,  77],
            [ 20,  23,  78],
            [ 20,  22,  79],
            ...,
            [ 79, 117, 190],
            [ 80, 118, 191],
            [ 88, 126, 199]],

           ...,

           [[153,  13,  24],
            [163,  18,  31],
            [164,  18,  29],
            ...,
            [ 14,  13,  19],
            [ 13,  12,  18],
            [ 11,  10,  16]],

           [[149,  12,  22],
            [156,  14,  26],
            [160,  16,  26],
            ...,
            [ 13,  12,  18],
            [ 13,  12,  18],
            [ 12,  11,  17]],

           [[150,  12,  25],
            [154,  14,  25],
            [157,  16,  25],
            ...,
            [ 14,  13,  19],
            [ 14,  13,  19],
            [ 14,  13,  19]]], dtype=uint8)
:::
:::

::: {.cell .code execution_count="4"}
``` python
plt.imshow(image_array)
plt.show()
```

::: {.output .execute_result execution_count="4"}
![](fcbe61351f965c3664d65d5e93991915402e0483.png)
:::
:::

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

* Re: Images in Jupyter Notebook to Markdown conversion
       [not found] ` <6d84aa5d-bdc8-4612-b471-c7b270f3936an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-12-29 19:27   ` John MacFarlane
       [not found]     ` <m2ilv7yzwk.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: John MacFarlane @ 2021-12-29 19:27 UTC (permalink / raw)
  To: Sébastien Boisgérault, pandoc-discuss


See the --extract-media option in the manual.


Sébastien Boisgérault <sebastien.boisgerault-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Hello everyone,
>
> When i convert the images.ipynb notebook to markdown, the resuting document 
> contains
>
> ::: {.output .execute_result execution_count="4"}
> ![](fcbe61351f965c3664d65d5e93991915402e0483.png)
> :::
>
> but AFAICT, the png file is not generated. Using the standalone option does 
> not change anything. And of course, the round-tripping (md -> ipynb) fails 
> with:
>
> File fcbe61351f965c3664d65d5e93991915402e0483.png not found in resource path
>
> The original notebook can be visualized here: 
> https://github.com/boisgera/python-advanced-eval/blob/master/samples/images.ipynb. 
> The (Grace Hopper) image it contains is an image/png cell output 
> (Matplotlib is used to display the image) :
>
>   {
>    "cell_type": "code",
>    "execution_count": 4,
>    "metadata": {},
>    "outputs": [
>     {
>      "data": {
>       "image/png": 
> "iVBORw0KGgoAAAANSUhEUgAAAgAAAAJYCAIAAACbx8k3AAEAAElEQVR4nGT92dMsWZIfhrn72SIil2+/S9Xtqq7qbboxPSswwGAAGQwkRYEyQgYZARIvMiNIo0wveseDTGaCXkTqX+CLKJO4CRIIgaSGAIfAAAPMYLqnZ+nprurat7t+Wy4RcTZ3PXhGVPYgH67lzS8z4sRZfPn5z93x6tG/7X3jXUA0tWApAgAGbd/vlst 
> ...
>
> I am using pandoc 2.16.2 (Linux). Is it considered a bug or am I missing 
> something? Shall I file an issue? 
>
> Regards,
>
> Sébastien
>
>
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/6d84aa5d-bdc8-4612-b471-c7b270f3936an%40googlegroups.com.
> ---
> jupyter:
>   nbformat: 4
>   nbformat_minor: 2
> ---
>
> ::: {.cell .code execution_count="1"}
> ``` python
> import matplotlib.pyplot as plt
> from matplotlib.cbook import get_sample_data
> ```
> :::
>
> ::: {.cell .code execution_count="2"}
> ``` python
> with get_sample_data("grace_hopper.jpg") as file:
>     image_array = plt.imread(file)
> ```
> :::
>
> ::: {.cell .code execution_count="3"}
> ``` python
> image_array
> ```
>
> ::: {.output .execute_result execution_count="3"}
>     array([[[ 21,  24,  77],
>             [ 27,  30,  85],
>             [ 33,  35,  92],
>             ...,
>             [ 76, 114, 189],
>             [ 71, 109, 184],
>             [ 76, 114, 189]],
>
>            [[ 26,  29,  82],
>             [ 25,  28,  83],
>             [ 27,  29,  86],
>             ...,
>             [ 60,  98, 173],
>             [ 56,  94, 169],
>             [ 62, 100, 175]],
>
>            [[ 21,  24,  77],
>             [ 20,  23,  78],
>             [ 20,  22,  79],
>             ...,
>             [ 79, 117, 190],
>             [ 80, 118, 191],
>             [ 88, 126, 199]],
>
>            ...,
>
>            [[153,  13,  24],
>             [163,  18,  31],
>             [164,  18,  29],
>             ...,
>             [ 14,  13,  19],
>             [ 13,  12,  18],
>             [ 11,  10,  16]],
>
>            [[149,  12,  22],
>             [156,  14,  26],
>             [160,  16,  26],
>             ...,
>             [ 13,  12,  18],
>             [ 13,  12,  18],
>             [ 12,  11,  17]],
>
>            [[150,  12,  25],
>             [154,  14,  25],
>             [157,  16,  25],
>             ...,
>             [ 14,  13,  19],
>             [ 14,  13,  19],
>             [ 14,  13,  19]]], dtype=uint8)
> :::
> :::
>
> ::: {.cell .code execution_count="4"}
> ``` python
> plt.imshow(image_array)
> plt.show()
> ```
>
> ::: {.output .execute_result execution_count="4"}
> ![](fcbe61351f965c3664d65d5e93991915402e0483.png)
> :::
> :::

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2ilv7yzwk.fsf%40MacBook-Pro-2.hsd1.ca.comcast.net.


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

* Re: Images in Jupyter Notebook to Markdown conversion
       [not found]     ` <m2ilv7yzwk.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
@ 2021-12-29 19:52       ` Sébastien Boisgérault
  0 siblings, 0 replies; 3+ messages in thread
From: Sébastien Boisgérault @ 2021-12-29 19:52 UTC (permalink / raw)
  To: John MacFarlane; +Cc: pandoc-discuss

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

On Wed, Dec 29, 2021 at 8:28 PM John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote:

>
> See the --extract-media option in the manual.
>

Thank you ! 👍


>
>
> Sébastien Boisgérault <sebastien.boisgerault-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > Hello everyone,
> >
> > When i convert the images.ipynb notebook to markdown, the resuting
> document
> > contains
> >
> > ::: {.output .execute_result execution_count="4"}
> > ![](fcbe61351f965c3664d65d5e93991915402e0483.png)
> > :::
> >
> > but AFAICT, the png file is not generated. Using the standalone option
> does
> > not change anything. And of course, the round-tripping (md -> ipynb)
> fails
> > with:
> >
> > File fcbe61351f965c3664d65d5e93991915402e0483.png not found in resource
> path
> >
> > The original notebook can be visualized here:
> >
> https://github.com/boisgera/python-advanced-eval/blob/master/samples/images.ipynb.
>
> > The (Grace Hopper) image it contains is an image/png cell output
> > (Matplotlib is used to display the image) :
> >
> >   {
> >    "cell_type": "code",
> >    "execution_count": 4,
> >    "metadata": {},
> >    "outputs": [
> >     {
> >      "data": {
> >       "image/png":
> >
> "iVBORw0KGgoAAAANSUhEUgAAAgAAAAJYCAIAAACbx8k3AAEAAElEQVR4nGT92dMsWZIfhrn72SIil2+/S9Xtqq7qbboxPSswwGAAGQwkRYEyQgYZARIvMiNIo0wveseDTGaCXkTqX+CLKJO4CRIIgaSGAIfAAAPMYLqnZ+nprurat7t+Wy4RcTZ3PXhGVPYgH67lzS8z4sRZfPn5z93x6tG/7X3jXUA0tWApAgAGbd/vlst
>
> > ...
> >
> > I am using pandoc 2.16.2 (Linux). Is it considered a bug or am I missing
> > something? Shall I file an issue?
> >
> > Regards,
> >
> > Sébastien
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "pandoc-discuss" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/6d84aa5d-bdc8-4612-b471-c7b270f3936an%40googlegroups.com
> .
> > ---
> > jupyter:
> >   nbformat: 4
> >   nbformat_minor: 2
> > ---
> >
> > ::: {.cell .code execution_count="1"}
> > ``` python
> > import matplotlib.pyplot as plt
> > from matplotlib.cbook import get_sample_data
> > ```
> > :::
> >
> > ::: {.cell .code execution_count="2"}
> > ``` python
> > with get_sample_data("grace_hopper.jpg") as file:
> >     image_array = plt.imread(file)
> > ```
> > :::
> >
> > ::: {.cell .code execution_count="3"}
> > ``` python
> > image_array
> > ```
> >
> > ::: {.output .execute_result execution_count="3"}
> >     array([[[ 21,  24,  77],
> >             [ 27,  30,  85],
> >             [ 33,  35,  92],
> >             ...,
> >             [ 76, 114, 189],
> >             [ 71, 109, 184],
> >             [ 76, 114, 189]],
> >
> >            [[ 26,  29,  82],
> >             [ 25,  28,  83],
> >             [ 27,  29,  86],
> >             ...,
> >             [ 60,  98, 173],
> >             [ 56,  94, 169],
> >             [ 62, 100, 175]],
> >
> >            [[ 21,  24,  77],
> >             [ 20,  23,  78],
> >             [ 20,  22,  79],
> >             ...,
> >             [ 79, 117, 190],
> >             [ 80, 118, 191],
> >             [ 88, 126, 199]],
> >
> >            ...,
> >
> >            [[153,  13,  24],
> >             [163,  18,  31],
> >             [164,  18,  29],
> >             ...,
> >             [ 14,  13,  19],
> >             [ 13,  12,  18],
> >             [ 11,  10,  16]],
> >
> >            [[149,  12,  22],
> >             [156,  14,  26],
> >             [160,  16,  26],
> >             ...,
> >             [ 13,  12,  18],
> >             [ 13,  12,  18],
> >             [ 12,  11,  17]],
> >
> >            [[150,  12,  25],
> >             [154,  14,  25],
> >             [157,  16,  25],
> >             ...,
> >             [ 14,  13,  19],
> >             [ 14,  13,  19],
> >             [ 14,  13,  19]]], dtype=uint8)
> > :::
> > :::
> >
> > ::: {.cell .code execution_count="4"}
> > ``` python
> > plt.imshow(image_array)
> > plt.show()
> > ```
> >
> > ::: {.output .execute_result execution_count="4"}
> > ![](fcbe61351f965c3664d65d5e93991915402e0483.png)
> > :::
> > :::
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAKYpyK51vsg1KeTGUqWJeUP-Nx8TqvqGHh3uMoMDmw1tmijZrA%40mail.gmail.com.

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

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

end of thread, other threads:[~2021-12-29 19:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-27 10:36 Images in Jupyter Notebook to Markdown conversion Sébastien Boisgérault
     [not found] ` <6d84aa5d-bdc8-4612-b471-c7b270f3936an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-12-29 19:27   ` John MacFarlane
     [not found]     ` <m2ilv7yzwk.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2021-12-29 19:52       ` Sébastien Boisgérault

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 NNTP newsgroup(s).