Data Science Asked by Tushar Gautam on September 1, 2021
I’ve created masks(numpy array with 0,1 as values) and tried exporting this array to jpg using matplolib but it’s not exporting the values as it is. I’m getting a range of pixel values in resulting image. Is there any way in which I can add the array values to pixel values as it is. For example numpy array is 40X40 and resulting jpg image resolution is 40X40 pixels.
When you simply use say plt.savefig() to jpg, matplotlib by default does not save it to a binary image as you require. JPG by default the definition is values ranging from 0-255. Suggest using PIL instead of matplotlib then you can save as BW binary image.
Answered by Arun Aniyan on September 1, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP