convert opencv image to pil image

import cv2
import numpy as np
from PIL import Image

img = cv2.imread("path/to/img.png")

# You may need to convert the color.
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
im_pil = Image.fromarray(img)

# For reversing the operation:
im_np = np.asarray(im_pil)

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
convert opencv to pillow image from cv2 to PIL image opencv to pillow how to convert opencv image to pil image python cv2 image to pil image cv image to pil image opencv image to qimage python convert cv2 to pil image convert image cv2 to pil convert cv2 image to pil convert pillow image to opencv image pillow image to opencv pass img from opencv to pillow convert pil to opencv how to convert a pil image to opencv how to convert a pillow image to opencv pil image to opencv image converting pillow format image to opencv image feed opencv image to PIL convert opencv image array to pil from opencv2 image to pillow image python opencv pil convert convert pil image to cv2 convert image from pil to opencv format pil image to opencv convert opencv to PIL format cv2 to pil image pil image to cv2 image opencv image to pil image convert PIL Image to opencv umat convert pil image to cv2 image python convert pil image to cv2 image how to convert cv2 image to pil image from pil image to opencv hwo to turn PIL image object to opencv image pillow convert to opencv convert cv2 image to pil image pil image to cv2 img cv2 image to pil image convert pil image to opencv python pil image to cv2 how to convert pil image to cv2 image pil image to cv2 convert cv2 frame object to pillow image object how to convert cv2 image into PIL image how to convert cv2 image to sikit image image to image transfer opencv how to convert string back into PIL.PngImagePlugin.PngImageFile how to convert something to PIL format python convert to PIL iamge opencv to pil image code to convert pil image to opencv image python cv2 to pil image python convert to pil inage python PIL Image form cv2 convert opencv image to pil color channel ordering issue in while converting cv2 image to pil image cv2 image to png pil cv2 image to pil from cv2 to pil give cv2 frame to pillow image cv2 to pil opencv image convert PIl how to use cv2 and pillow in python convert in opencv2 python opencv image format conversion python convert opencv image to pil image
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source