当前位置: 首页 > news >正文

网页 网站网站开发可以用哪些语言

网页 网站,网站开发可以用哪些语言,wordpress开启启gzip,群晖 建站 Wordpress老板给了张没有atlas文件的图集让我拆图#xff0c;简单写了一版凑合用。 存在的问题#xff1a; 可能会拆出来一些小尺寸的透明像素图片#xff1b;可能会拆出来一些偏大的小图的整体集合#xff1b;可能会把应该是一块的小图批成两半#xff0c;不过不多#xff1b;其…老板给了张没有atlas文件的图集让我拆图简单写了一版凑合用。 存在的问题 可能会拆出来一些小尺寸的透明像素图片可能会拆出来一些偏大的小图的整体集合可能会把应该是一块的小图批成两半不过不多其他未知的问题... 小图目测基本齐全没用的图...手删一下趴 有改正的同学烦请告知比个♥ from PIL import Image import numpy as np import timedef split_image_into_blocks(image_path, threshold0): img Image.open(image_path) if img.mode ! RGBA: img img.convert(RGBA) # 转换到RGBA模式以获取alpha通道 img_data np.array(img) width, height img.size output_index 0col_start_index np.zeros(height, dtypeint) # 弃用有问题应该划分块regions []def detect_bounding_box(row, col):# 初始化包围盒 min_row, max_row row, row min_col, max_col col, col if min_row height:return min_row, min_col, max_row, max_coldef extern_bottom_left_right(row, min_col, max_col):# 最大行向下扩展max_row row# 最小列向左扩展if min_col 0:for col in range(min_col - 1, -1, -1):if img_data[row, col, 3] ! threshold and col min_col:min_col colelse:break# 最大列向右扩展if max_col width:for col in range(max_col 1, width):if img_data[row, col, 3] ! threshold and col max_col:max_col colelse:breakreturn min_col, max_row, max_col# 开始向下拓展for row in range(min_row 1, height):# 非透明像素if img_data[row, min_col, 3] ! threshold:min_col, max_row, max_col extern_bottom_left_right(row, min_col, max_col)# 当前行最小列是透明像素else:# 向右判断当前行包围盒是否全为透明像素row_all_0_flag Truefor col in range(min_col 1, max_col):if img_data[row, col, 3] ! threshold:row_all_0_flag Falsemin_col, max_row, max_col extern_bottom_left_right(row, min_col, max_col)break# 当前行包围盒全透明封闭包围盒if row_all_0_flag:breakreturn min_row, min_col, max_row, max_col# 遍历图像以找到非“透明”区域 for row in range(height): col 0while col width:if img_data[row, col, 3] ! threshold: # 假设threshold是“透明”的替代值 bounding_box detect_bounding_box(row, col)print(f第{output_index}张图片包围盒{bounding_box})min_row, min_col, max_row, max_col bounding_box# 获取包围盒后置位透明img_data[min_row : max_row 1, min_col : max_col 1, 3] 0# 裁剪并保存图像块 cropped_img img.crop((min_col, min_row, max_col 1, max_row 1)) cropped_img.save(foutput3/output_{output_index}.png) print(f第{output_index}张图片保存成功路径output2/output_{output_index}.png)output_index 1 col col 1# 使用示例 start_time time.time() split_image_into_blocks(texture_00.png, threshold0) # 假设0是“透明”的替代值 end_time time.time() usage_time int(end_time - start_time) m usage_time // 60 s usage_time % 60 print(f任务执行完成耗时{m}分{s}秒)
http://www.hkea.cn/news/14277422/

相关文章:

  • 什么网站做电脑系统好校园兼职网站建设
  • 基础网站建设素材国内开源建站cms
  • 徐州住房与城乡建设部网站青岛谁优化网站做的好处
  • 各类东莞微信网站建设推广网站如何做
  • 中英文网站建设需要懂英语吗网页qq登陆保护怎么关
  • 网站推广的英文content有口碑的合肥网站建设
  • 梅州网站建设wordpress搬家后空白
  • 雄安网站建设优化公司wordpress访问权限
  • 找人做网站注意哪些网站链接失效怎么做
  • 做淘宝主要看哪些网站cuteftp可以上传网站吗
  • 网站开发用什么代码vi企业形象设计公司
  • 济南网站建设成之运维开网店被运营公司骗了怎么办
  • 做游戏网站需要哪些许可句容建设网站
  • 网站改备案吗flash网站教程
  • 邢台网站制作盐田高端网站建设
  • 百度网站收录查询昆山网站网站建设
  • 河源做网站的客户海南 网站开发
  • 莱州网站建设有限公司网络信用贷款哪个好
  • 重庆建网站的公司集中在哪里长春城乡建设部网站首页
  • 网站响应度微信管理系统下载
  • 在ps中如何做网站框架微信小程序开发教程书
  • 济南免费网站建设网页设计实训总结800字
  • 北京国贸网站建设海南手机网站建设公司哪家好
  • 成都企业网站建设费用深圳营销型网站建设服务商
  • 成都企业建设网站湖北专业网站建设检修
  • 网站建设公司的服务器ui网页设计课程总结
  • 商业网站建设视频教程一个县城广告公司利润
  • 申请号的网站网站设计怎么弄
  • 高校门户网站的建设如何在网站插做视频
  • 网站开发环境怎么写聊城开发网站建设