Skip to content

Commit

Permalink
modify sentence subjects
Browse files Browse the repository at this point in the history
  • Loading branch information
hchqin committed Jan 26, 2024
1 parent 1272c66 commit 7b28231
Showing 1 changed file with 55 additions and 6 deletions.
61 changes: 55 additions & 6 deletions docs/example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"from hexdropper.rgb_to_hex import rgb_to_hex\n",
"from hexdropper.create_color_image import create_color_image\n",
"from matplotlib import pyplot as plt\n",
"from PIL import Image\n",
"import numpy as np"
]
},
Expand All @@ -51,7 +50,7 @@
"metadata": {},
"source": [
"## Read image\n",
"Start by reading in a cropped image containing the colour you would like to match, using the `read_image` function and specifying the path to the image on your device. The image does not need to be perfectly cropped, as long as the colour you are interested in is most prominent."
"Start by reading in a cropped image containing the colour we would like to match, using the `read_image` function and specifying the path to the image on the device. The image does not need to be perfectly cropped, as long as the colour we are interested in is most prominent."
]
},
{
Expand Down Expand Up @@ -178,8 +177,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Use the hexcode to create complimentary visualizations for your project!\n",
"Now that you know the hexcode of that logo, you can create visualizations that are a perfect colour match. Here is an example using `matplotlib` specifying the hexcode as a parameter."
"## Use the hexcode to create complimentary visualizations!\n",
"Now that we know the hexcode of MDS logo, we can create visualizations that are a perfect colour match. Here is an example using `matplotlib` specifying the hexcode as a parameter."
]
},
{
Expand Down Expand Up @@ -218,14 +217,64 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Save"
"## Export the extrated color as an image"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now, we'll use this color code to create a new image. This image will solely feature the extracted color and display the color code at its center. This helps us have a visual reference of the color when designing graphics that coordinate with the logo's color scheme."
"Now, we can use this color code to create a new image. This image will solely feature the extracted color. This can help us have a visual reference of the color when designing graphics that coordinate with MDS logo's color scheme."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"By default, the function will create a 200x200 pixel image with the extrated color. The image will be saved in the current working directory and named with the color code (e.g., 08B5D4.png)."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"hex_code = '08B5D4'\n",
"create_color_image(hex_code)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can also change the size of the image or the location where it is saved, we can do so by adjusting the parameters of the `create_color_image` function."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Create a 100x100 pixel image and save it to a specific path\n",
"create_color_image(hex_code, image_size=(100, 100), output_path='/path/to/save/08B5D4.png')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Conclusion"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Through this tutorial, we've demonstrated how to use the `hexdropper` package to extract color from a given image and use the color for visualizations or color reference. This package is especially useful for designers and developers who need visuals that match or complement colors extracted from images, as demonstrated with the UBC MDS Logo in our example.\n",
"\n",
"If you have any questions or feedback about `hexdropper`, feel free to reach out or contribute to our project. Happy color dropping!"
]
}
],
Expand Down

0 comments on commit 7b28231

Please sign in to comment.