Automatic Thumbnail???

25 views
Skip to first unread message

Loren

unread,
Jul 2, 2020, 4:30:17 PM7/2/20
to nikola-discuss
Hi everyone,

I'm new to Nikola and have a question about thumbnails. If I want to make a gallery of Jupyter Notebooks, is there a way to have Nikola automatically make the thumbnails for the Jupyter Notebooks? Currently, we take a screenshot of each Jupyter Notebook, save it as a jpeg in the images folder, then we reference the thumbnail in the Main Gallery. Is there a way to automate this?


Jim Schmitz

unread,
Jul 2, 2020, 5:21:02 PM7/2/20
to nikola-...@googlegroups.com
There is the "nbconvert" command-line tool that can convert notebooks to other formats like html or pdf.


From there you can use another tool to convert the pdfs to jpg. A quick Google search turns up a tool called "pdftocairo" that can do this, but there are probably many other options.






On Thu, Jul 2, 2020 at 4:30 PM Loren <lp...@ucar.edu> wrote:
Hi everyone,

I'm new to Nikola and have a question about thumbnails. If I want to make a gallery of Jupyter Notebooks, is there a way to have Nikola automatically make the thumbnails for the Jupyter Notebooks? Currently, we take a screenshot of each Jupyter Notebook, save it as a jpeg in the images folder, then we reference the thumbnail in the Main Gallery. Is there a way to automate this?


--
You received this message because you are subscribed to the Google Groups "nikola-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nikola-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nikola-discuss/b21c011b-e04f-4dc8-acc5-0d040c8cebb2n%40googlegroups.com.

Chris Warrick

unread,
Jul 3, 2020, 6:33:03 PM7/3/20
to Nikola—Discuss
On Thu, 2 Jul 2020 at 23:21, Jim Schmitz <james....@gmail.com> wrote:
>
> There is the "nbconvert" command-line tool that can convert notebooks to other formats like html or pdf.
>
> https://nbconvert.readthedocs.io/en/latest/
>
> From there you can use another tool to convert the pdfs to jpg. A quick Google search turns up a tool called "pdftocairo" that can do this, but there are probably many other options.
>
>
>
>
>
>
> On Thu, Jul 2, 2020 at 4:30 PM Loren <lp...@ucar.edu> wrote:
>>
>> Hi everyone,
>>
>> I'm new to Nikola and have a question about thumbnails. If I want to make a gallery of Jupyter Notebooks, is there a way to have Nikola automatically make the thumbnails for the Jupyter Notebooks? Currently, we take a screenshot of each Jupyter Notebook, save it as a jpeg in the images folder, then we reference the thumbnail in the Main Gallery. Is there a way to automate this?
>>

Another option would be something to automatically screenshot
webpages. We use puppeteer for this in the nikola-themes repo. You
could make a Nikola plugin to generate the screenshots automatically
(simple file_dep + code from
pkgindex_theme_demo_screenshots/take_screenshots.js), but this will
require you to run `nikola build` twice (first run would build .ipynb
and make screenshots, and the second run would update the gallery).

--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16

Loren

unread,
Jul 6, 2020, 9:39:36 AM7/6/20
to nikola-discuss
Hey everyone! Thanks so much for your assistance! Both of these appear to be great solutions!
Reply all
Reply to author
Forward
0 new messages