In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what is the method of numpy-to-Pillow conversion". The explanation in the article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the method of numpy-to-Pillow interconversion".
The lab code shows:
From PIL import Image, ImageDrawimport numpy as npim = Image.open (bryant.jpg) # im.show () ima = np.asarray (im) a.shape, a.dtype, a.min (), a.max () type (a.shape) im2 = Image.fromarray (a) # im2.show () im2# The crop method from the Image module takes four coordinates as input.# The right can also be represented as (left+width) # and lower can be represented as (upper+height). (left, upper, right, lower) = (500,20,900) Here the image "im" is cropped and assigned to new variable im_cropim_crop = im.crop ((left, upper, right, lower)) # im_crop.show () im_cropim (width, height) = (im.width / / 2, im.height / / 2) im_resized = im.resize ((width, height)) # im_resized.show () im_resizedim.resize ((200,300), box= (500,20,900,400) imdraw = ImageDraw.Draw (im) draw.rectangle ((500,20,900) 400), outline= (255255255), width=8,) im
Show the running results:
Thank you for your reading, the above is the content of "what is the method of numpy-to-Pillow conversion". After the study of this article, I believe you have a deeper understanding of what the method of numpy-to-Pillow conversion is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.