Quantcast
Channel: How to convert a NumPy array to PIL image applying matplotlib colormap - Stack Overflow
Browsing all 4 articles
Browse latest View live

Answer by aravinda_gn for How to convert a NumPy array to PIL image applying...

input = numpy_imagenp.uint8 -> converts to integersconvert('RGB') -> converts to RGBImage.fromarray -> returns an image object from PIL import Image import numpy as np PIL_image =...

View Article


Answer by Shital Shah for How to convert a NumPy array to PIL image applying...

The method described in the accepted answer didn't work for me even after applying changes mentioned in its comments. But the below simple code worked:import matplotlib.pyplot as...

View Article


Image may be NSFW.
Clik here to view.

Answer by fraxel for How to convert a NumPy array to PIL image applying...

Quite a busy one-liner, but here it is:First ensure your NumPy array, myarray, is normalised with the max value at 1.0.Apply the colormap directly to myarray.Rescale to the 0-255 range.Convert to...

View Article

How to convert a NumPy array to PIL image applying matplotlib colormap

I have a simple problem, but I cannot find a good solution to it.I want to take a NumPy 2D array which represents a grayscale image, and convert it to an RGB PIL image while applying some of the...

View Article
Browsing all 4 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>