public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
To: "Sébastien Boisgérault"
	<sebastien.boisgerault-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	pandoc-discuss
	<pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Images in Jupyter Notebook to Markdown conversion
Date: Wed, 29 Dec 2021 11:27:55 -0800	[thread overview]
Message-ID: <m2ilv7yzwk.fsf@MacBook-Pro-2.hsd1.ca.comcast.net> (raw)
In-Reply-To: <6d84aa5d-bdc8-4612-b471-c7b270f3936an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>


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.


  parent reply	other threads:[~2021-12-29 19:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-27 10:36 Sébastien Boisgérault
     [not found] ` <6d84aa5d-bdc8-4612-b471-c7b270f3936an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-12-29 19:27   ` John MacFarlane [this message]
     [not found]     ` <m2ilv7yzwk.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2021-12-29 19:52       ` Sébastien Boisgérault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2ilv7yzwk.fsf@MacBook-Pro-2.hsd1.ca.comcast.net \
    --to=jgm-tvlzxgkolnx2fbvcvol8/a@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=sebastien.boisgerault-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).