MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / fig2img

Method fig2img

PATH/core/data/datasets/images/image_helper.py:223–232  ·  view source on GitHub ↗

@brief Convert a Matplotlib figure to a PIL Image in RGBA format and return it @param fig a matplotlib figure @return a Python Imaging Library ( PIL ) image

(fig)

Source from the content-addressed store, hash-verified

221
222 @staticmethod
223 def fig2img(fig):
224 """
225 @brief Convert a Matplotlib figure to a PIL Image in RGBA format and return it
226 @param fig a matplotlib figure
227 @return a Python Imaging Library ( PIL ) image
228 """
229 # put the figure pixmap into a numpy array
230 buf = ImageHelper.fig2data(fig)
231 h, w, d = buf.shape
232 return Image.frombytes("RGBA", (w, h), buf.tostring())
233
234 @staticmethod
235 def fig2np(fig):

Callers

nothing calls this directly

Calls 1

fig2dataMethod · 0.80

Tested by

no test coverage detected