If you are getting the no module named imwatermark error then it can be the reason that imwatermark module is not installed in your system. In this tutorial, you will know how to solve the ModuleNotFoundError: no module named imwatermark error in an easy way.
What is the imwatermark?
Imwatermark is a Python-based library for protecting images through watermarking. It offers an interface for conveniently adding watermarks to images, which is the practice of embedding a visible or invisible mark to safeguard against or indicate the ownership of an image. With Imwatermark, you can embed text or image watermarks, customize their transparency and placement, and store the images with the watermark applied.
Why ModuleNotFoundError: no module named imwatermark error Occurs ?
The “no module named imwatermark” error occurs when you are trying to import the “imwatermark” module in Python. But the module has not been installed on the system. And python is trying to find the module but it is unable to find it.
You will get the error when you try to run the below lines of code.
from imwatermark import Watermark wm = Watermark() wm.add_text("Copyright © Code The Best", fontsize=24, color='white') wm.watermark_image("input_image.jpg", "output_image.jpg")
ModuleNotFoundError: no module named imwatermark
Solve no module named imwatermark error
You can easily solve the no module named imwatermark error by implementing the following solutions.
Solution 1: Install the imwatermark module
You can solve the issue by installing the imwatermark module. Using pip, a package installer for Python, the imwatermark module can be installed. To do so, open a terminal or command prompt and enter the following command.
pip install imwatermark
Solution 2: Check the module path
Verify that the imwatermark module is located in the path that Python searches for modules. To check, execute the following Python code.
import sys print(sys.path)
Solution 3: Check the module name for typoerror
There can also be a typo error while importing the module. Ensure that you are importing the imwatermark module with the exact spelling and capitalization. Also, double-check that you are not misspelling the name of the module.
Imwatermark is a Python library for watermarking images that provides a simple way of adding text or image watermarks to images, adjusting their transparency and placement, and saving the watermarked images to disk. The “no module named imwatermark” error occurs when you are trying to import the imwatermark module in Python. However, it is not installed in the system or you are unable to find the module path. This issue can be solved by installing the imwatermark module using pip. Also, check the module path and confirm that the right module name is used.