Skip to content

Commit

Permalink
v0.2.22
Browse files Browse the repository at this point in the history
  • Loading branch information
yh202109 committed Aug 28, 2024
1 parent bb4192b commit d59b207
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions docs/std_iso_pdf.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Image \n",
"## Work with Images\n",
"\n",
"We can see that there is one image in the 3rd page from the summary above. \n",
"To extract the first image on the 3rd page:"
Expand All @@ -134,7 +134,8 @@
"outputs": [],
"source": [
"img = pfr.get_image(page_index=2, image_index=0, outfolder='')\n",
"print(type(img))\n"
"print(type(img))\n",
"print(img.size)"
]
},
{
Expand All @@ -158,9 +159,32 @@
}
},
"source": [
"The `resize()` function above resized the figure before displaying. Use `display(img)` in `Jupyter` if resizing is not required.\n",
"\n",
"To save the 2nd image on the 4th page to a file, add an existing folder path using `outfolder='add_path_here'`:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "plaintext"
}
},
"outputs": [],
"source": [
"img_path = pfr.get_image(page_index=3, image_index=1, outfolder='.')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The function `get_image()` returns a file path instead of the image when the `outfolder` option is not an empty string. \n",
"To read and display the saved image file in `Jupyter`:"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -173,7 +197,6 @@
"source": [
"from IPython.display import Image \n",
"\n",
"img_path = pfr.get_image(page_index=3, image_index=1, outfolder='.')\n",
"img = Image(filename=img_path, width=300)\n",
"display(img)"
]
Expand Down

0 comments on commit d59b207

Please sign in to comment.