How to apply a浮雕 effect to an image in Pillow?

Nov 24, 2025

Leave a message

David Smith
David Smith
David is a senior mold designer at Suzhou Dongying Precision Mould Co., Ltd. With over 10 years of experience in precision mold production, he has played a key role in the company's independent mold development since 2009.

Hey there! As a Pillow supplier, I've had my fair share of exploring the cool features and applications of Pillow in image processing. One really neat effect that you can achieve with Pillow is the relief effect. In this blog, I'm gonna walk you through how to apply a relief effect to an image using Pillow.

First off, let's talk a bit about what Pillow is. Pillow is a powerful Python library for image processing. It's super handy and has a ton of features that can help you manipulate images in all sorts of ways. You can check out more about it on our website Pillow.

Prerequisites

Before we get started, you need to have Pillow installed. If you haven't installed it yet, you can easily do so using pip. Just open up your terminal and run the following command:

pip install pillow

Once you've got Pillow installed, you're ready to go!

Step 1: Import the necessary libraries

The first thing you need to do in your Python script is import the Image and ImageFilter modules from the Pillow library. Here's how you do it:

from PIL import Image, ImageFilter

The Image module is used to open, manipulate, and save different image file formats. The ImageFilter module provides a set of pre-defined image filters that you can apply to your images, including the relief filter which we'll be using.

Step 2: Open the image

Next, you need to open the image that you want to apply the relief effect to. You can do this using the open() method of the Image module. Here's an example:

Busbar U V W17335628263059f54c4f920cf28f75e407089c30353d6

image = Image.open('your_image.jpg')

Replace 'your_image.jpg' with the actual path to your image file. Make sure the image file is in a supported format like JPEG, PNG, etc.

Step 3: Apply the relief effect

Now comes the fun part! To apply the relief effect to the image, you can use the filter() method of the Image object and pass in the ImageFilter.EMBOSS filter. Here's how it's done:

relief_image = image.filter(ImageFilter.EMBOSS)

The filter() method applies the specified filter to the image and returns a new Image object with the filter applied. In this case, the ImageFilter.EMBOSS filter creates a relief effect on the image.

Step 4: Save the processed image

Once you've applied the relief effect to the image, you can save the processed image to a file. You can use the save() method of the Image object to do this. Here's an example:

relief_image.save('relief_image.jpg')

Replace 'relief_image.jpg' with the name and path where you want to save the processed image.

Putting it all together

Here's the complete Python script that applies a relief effect to an image using Pillow:

from PIL import Image, ImageFilter

# Open the image
image = Image.open('your_image.jpg')

# Apply the relief effect
relief_image = image.filter(ImageFilter.EMBOSS)

# Save the processed image
relief_image.save('relief_image.jpg')

That's it! You've successfully applied a relief effect to an image using Pillow.

Customizing the relief effect

The basic relief effect created by the ImageFilter.EMBOSS filter is pretty cool, but you can also customize it to get different results. For example, you can adjust the intensity of the relief effect by applying the filter multiple times. Here's how you can do it:

from PIL import Image, ImageFilter

# Open the image
image = Image.open('your_image.jpg')

# Apply the relief effect multiple times for a stronger effect
for _ in range(3):
    image = image.filter(ImageFilter.EMBOSS)

# Save the processed image
image.save('custom_relief_image.jpg')

In this example, the relief filter is applied three times to the image, resulting in a stronger relief effect.

Other related applications

Applying a relief effect to an image can be used in various creative ways. For example, it can be used in graphic design to add a 3D-like effect to logos, posters, or other visual elements. It can also be used in photography to enhance the texture and depth of an image.

If you're interested in other types of image processing applications, you might also want to check out some of our other products. We offer a wide range of tools and services related to image processing and mold tooling. For example, our Fisheye Terminals and Busbar U V W products are designed to meet the needs of different industries.

Conclusion

In conclusion, applying a relief effect to an image using Pillow is a simple and fun way to enhance your images. With just a few lines of Python code, you can transform a regular image into a stunning one with a 3D-like effect. Whether you're a graphic designer, photographer, or just someone who loves playing around with images, Pillow is a great tool to have in your arsenal.

If you're interested in purchasing our Pillow products or have any questions about image processing, feel free to reach out to us. We're always happy to help and look forward to discussing your needs and finding the best solutions for you.

References

  • Pillow Documentation: https://pillow.readthedocs.io/en/stable/
  • Python Official Website: https://www.python.org/
Send Inquiry