Skip to main content

A command-line tool for extracting images from Jupyter Notebooks.

Project description

nbimgextract

License:MIT PyPI - Version codecov

nbimgextract is a command-line tool for extracting images from Jupyter Notebooks.

Usage

Usage: nbimgextract [OPTIONS] <FILE>

Arguments:
  <FILE>  path to ipynb file from which to extract files

Options:
  -o, --output-path <OUTPUT_PATH>  output directory for images
  -t, --tag-prefix <TAG_PREFIX>    Prefix for cell tags to create the file name
  -q, --quiet                      Disable output of written files
  -Q, --print-filenames            Output written files to terminal [default]
      --dry-run                    Do not write any files
      --write-files                Write image files [default]
  -h, --help                       Print help
  -V, --version                    Print version

Non Empty Dir Actions:
      --error      Raise an error when the target directory is not empty [default]
      --clear-dir  If target dir is not empty, delete it
      --proceed    Ignore non-empty target dir

Output File Names

By default, the names of the image files extracted from a notebook are based on the ordinal number of the cell, zero-padded to the width of the cell count: for example, the image from the third cell of a 13-cell notebook is named img-03.

However, you can also specify the desired file names within the notebook in a few ways.

  1. Comment in the cell code
  2. Cell tag

If a cell has a valid comment and a valid tag, the comment has priority. If a cell produces multiple images/plots, these will be numbered: name-1, name-2, and so on. If two cells would produce the same file name, the later one gets a numeric suffix; images never silently overwrite each other.

Labels must be plain file names: a label containing a path separator or .. is ignored with a warning, and files are always written inside the output directory.

Comment

nbimagextract allows you to specify the desired image filename via a comment in the cell's code. To be detected, the comment must begin with label: — after the # and an optional | — followed by the desired filename. Both # label: name and Quarto's #| label: name forms work; comments that merely contain the word, such as # xlabel: time, do not set the name. Any whitespace around the filename will be trimmed.

The comment must appear in the cell's leading comment block: the comment lines at the very top of the cell, before the first code or blank line. A label: comment further down the cell is ignored.

For example, the plot produced by the cell with the following code will be saved as sin-plot.

# label: sin-plot
x = np.linspace(0, 2 * np.pi, 100)
y = np.sin(x)
plt.plot(x, y)

This closely follows the convention Quarto uses for applying labels to plots for the purposes of cross referencing, with the | after the # made optional.

Cell Tags

You can use cell tags to specify the file name for the image generated by that cell. The tag should start with img and anything after that prefix will be used in the file name. You can override this prefix with the --tag-prefix option. Any spaces, hyphens or underscores immediately following the prefix will be ignored. That is to say, if the tag is img-my-chart, the resulting file names will be called my-chart.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nbimgextract-0.3.0.tar.gz (158.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

nbimgextract-0.3.0-py3-none-win_amd64.whl (457.1 kB view details)

Uploaded Python 3Windows x86-64

nbimgextract-0.3.0-py3-none-win32.whl (422.5 kB view details)

Uploaded Python 3Windows x86

nbimgextract-0.3.0-py3-none-musllinux_1_2_x86_64.whl (671.3 kB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

nbimgextract-0.3.0-py3-none-musllinux_1_2_i686.whl (695.1 kB view details)

Uploaded Python 3musllinux: musl 1.2+ i686

nbimgextract-0.3.0-py3-none-musllinux_1_2_armv7l.whl (638.3 kB view details)

Uploaded Python 3musllinux: musl 1.2+ ARMv7l

nbimgextract-0.3.0-py3-none-musllinux_1_2_aarch64.whl (657.8 kB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

nbimgextract-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (618.9 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

nbimgextract-0.3.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (650.1 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ s390x

nbimgextract-0.3.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (739.8 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ppc64le

nbimgextract-0.3.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (672.9 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ i686

nbimgextract-0.3.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (602.3 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARMv7l

nbimgextract-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (604.1 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

nbimgextract-0.3.0-py3-none-macosx_11_0_arm64.whl (571.2 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

nbimgextract-0.3.0-py3-none-macosx_10_12_x86_64.whl (584.2 kB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file nbimgextract-0.3.0.tar.gz.

File metadata

  • Download URL: nbimgextract-0.3.0.tar.gz
  • Upload date:
  • Size: 158.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nbimgextract-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4a0bafeb92acb59b86a8afadba30a44e8ff192b0f6135d7c1e0515f458a5b0ca
MD5 5d8543fe1e8d2a3d261332b8288b0d82
BLAKE2b-256 ccf4cad60450b548608e49b030bcc063b4bfd70ffc309f35e43ec87418ea50fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbimgextract-0.3.0.tar.gz:

Publisher: CI.yml on felixgwilliams/nbimgextract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nbimgextract-0.3.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: nbimgextract-0.3.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 457.1 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nbimgextract-0.3.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 c0c5f0c488d31bc4dd2ead46208a970369dde0e1485da0a0fc88a632f962e229
MD5 7b359326e624272f1e55ff04c58568b0
BLAKE2b-256 a9a1ef91237ddf21dbe22c9c1fdbbd18e5628aa5e9170fe0a2c30844ded1cbaf

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbimgextract-0.3.0-py3-none-win_amd64.whl:

Publisher: CI.yml on felixgwilliams/nbimgextract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nbimgextract-0.3.0-py3-none-win32.whl.

File metadata

  • Download URL: nbimgextract-0.3.0-py3-none-win32.whl
  • Upload date:
  • Size: 422.5 kB
  • Tags: Python 3, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nbimgextract-0.3.0-py3-none-win32.whl
Algorithm Hash digest
SHA256 5c3301900586600b137cee885a6c39d9fbef96930ac13472f4e515e9602d478e
MD5 fb34e6f8e3a1f8d911730c86cf118233
BLAKE2b-256 b7e789ff0466e1666b6284589db3a22d49a161678839fe7385f3e31a82ba21df

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbimgextract-0.3.0-py3-none-win32.whl:

Publisher: CI.yml on felixgwilliams/nbimgextract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nbimgextract-0.3.0-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for nbimgextract-0.3.0-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9bfa7a2c2b75706cdf36e54c450d794fc8f58071b51edf3738f9d082f995a996
MD5 20421a745bbac55b7a8918c3985561e3
BLAKE2b-256 e9037004ff13b13f4606b74034af6272bc29bc465bd31e230ad096b52c0f8854

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbimgextract-0.3.0-py3-none-musllinux_1_2_x86_64.whl:

Publisher: CI.yml on felixgwilliams/nbimgextract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nbimgextract-0.3.0-py3-none-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for nbimgextract-0.3.0-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 8252ff15bcea3f91189217b1cfae67c73b006b06f781b77c31944a65e8be20ab
MD5 c2361e22f5add6bbcf182e66e2064d93
BLAKE2b-256 48a586de1a1e1a2c375c347c22cd84832e2c9da90c776dbacff5d93475dcb0ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbimgextract-0.3.0-py3-none-musllinux_1_2_i686.whl:

Publisher: CI.yml on felixgwilliams/nbimgextract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nbimgextract-0.3.0-py3-none-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for nbimgextract-0.3.0-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 d766bb6f07b8e84598f168a77c6480cb24640f00464b3e2dc5c1d26143aa6856
MD5 4d1fc64b858f9e6fc4ff9ba16539a278
BLAKE2b-256 b18507d037450c7ebef43b6211aaed35d9adec7b38ce98538dc1148bb24aba14

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbimgextract-0.3.0-py3-none-musllinux_1_2_armv7l.whl:

Publisher: CI.yml on felixgwilliams/nbimgextract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nbimgextract-0.3.0-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for nbimgextract-0.3.0-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 d363d12320e188d3289cf1fe9887bb60283e9e976165b93443182a4b471ef069
MD5 bb8de245f12efa8eed680bf4b6856524
BLAKE2b-256 d4dce2047fe09527ecf6b2e67001e64a34754acf614a303d94d219dcf73071a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbimgextract-0.3.0-py3-none-musllinux_1_2_aarch64.whl:

Publisher: CI.yml on felixgwilliams/nbimgextract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nbimgextract-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nbimgextract-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b5b6b3905f05d508ba4b78ec2ad2e7c75d6a3b2586359ace7e1a238b8a78fda
MD5 64256700312b0c46321ff2109a8d66d9
BLAKE2b-256 b55cd066d3c6bec6c5d46c79a222639647b6e7db26f7afc4735f2df4ccc3be4a

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbimgextract-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on felixgwilliams/nbimgextract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nbimgextract-0.3.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for nbimgextract-0.3.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 d6a695d430f8244859430dcd25e291400b6cd658342a54c4925cf530aae79f1c
MD5 f64c9dc9eed2c0607799416189614814
BLAKE2b-256 4031887c6d89ec79801265f5666a868053a268ec7297c437cf752bfd8cd3de53

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbimgextract-0.3.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl:

Publisher: CI.yml on felixgwilliams/nbimgextract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nbimgextract-0.3.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for nbimgextract-0.3.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 c62b474e7aef18126ed7e42ea26ee94b037d43ed0ef6680cf85f47c9fab28b41
MD5 bb9280f5bc887ae35259a243b06ec6b2
BLAKE2b-256 37d8260bf8048bab3d7c3fda86b9392100793bec5c13f5a55cfa1ed99a879ef8

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbimgextract-0.3.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl:

Publisher: CI.yml on felixgwilliams/nbimgextract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nbimgextract-0.3.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for nbimgextract-0.3.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 368d7c5d1d60a147a44298642a875abfb880231ede8729d5600cb851e8def3cf
MD5 dfc5de4386beaf659455a70eef2c4bbc
BLAKE2b-256 0f8991d80e8c3605337799f1861253fe9001db6cc82704c206568aeb7b5df496

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbimgextract-0.3.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: CI.yml on felixgwilliams/nbimgextract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nbimgextract-0.3.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for nbimgextract-0.3.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 afdee69ee30ef41c0ca3b200d15c7874930efebab2a9807e7b31c403c4fe5e2c
MD5 4715b3e5ba578a66debd93ecd88a0a47
BLAKE2b-256 0294404769c15f6ee6b2b82402b20b62774d2200aadc7ca43dab2fe6b38f6907

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbimgextract-0.3.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl:

Publisher: CI.yml on felixgwilliams/nbimgextract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nbimgextract-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nbimgextract-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f54e7663c1a1dddba5b83f5b9cf4f02a369fe9d0afb58e614afb83bc7d98c2dd
MD5 50a1db3e5ee30f6f5fde52f558ed2d3b
BLAKE2b-256 5e98473d1fbe54f0e801027b247958ae705dabda1e884d0ace9c3d907204138a

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbimgextract-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: CI.yml on felixgwilliams/nbimgextract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nbimgextract-0.3.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nbimgextract-0.3.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 48442348d730d827981623c1280f5230ba6efa32c287da9040217536a645a5ae
MD5 5ba2fc3b2cdcf0149d03360e9ca2b1e8
BLAKE2b-256 b47723d938f713fa5b18571284f97879fcfa61eedfa5345802c79bf2878dcbbf

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbimgextract-0.3.0-py3-none-macosx_11_0_arm64.whl:

Publisher: CI.yml on felixgwilliams/nbimgextract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nbimgextract-0.3.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for nbimgextract-0.3.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4806c1d138f3b1ab37e0befa04ccfcd1eeaf905000b8e14589916e53a5ad8110
MD5 2c3a0353ca5401e8687d10ac1266f029
BLAKE2b-256 e375b6d2f4927a86b5062240a1c68e3c6e6cef084076312d75ac33568a8cc424

See more details on using hashes here.

Provenance

The following attestation bundles were made for nbimgextract-0.3.0-py3-none-macosx_10_12_x86_64.whl:

Publisher: CI.yml on felixgwilliams/nbimgextract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page