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

wordpress 超时seo新方法

wordpress 超时,seo新方法,淘宝做图网站好,网站的建设步骤包括老板给了张没有atlas文件的图集让我拆图,简单写了一版凑合用。 存在的问题: 可能会拆出来一些小尺寸的透明像素图片;可能会拆出来一些偏大的小图的整体集合;可能会把应该是一块的小图批成两半,不过不多;其…

老板给了张没有atlas文件的图集让我拆图,简单写了一版凑合用。

存在的问题:

  • 可能会拆出来一些小尺寸的透明像素图片;
  • 可能会拆出来一些偏大的小图的整体集合;
  • 可能会把应该是一块的小图批成两半,不过不多;
  • 其他未知的问题...

小图目测基本齐全,没用的图...手删一下趴

有改正的同学烦请告知,比个♥

from PIL import Image  
import numpy as np  
import timedef split_image_into_blocks(image_path, threshold=0):  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, dtype=int)  # 弃用,有问题,应该划分块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(f"output3/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", threshold=0)  # 假设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.shuangfujiaoyu.com/news/30292.html

相关文章:

  • 免费建个人网站步骤湛江今日头条
  • 西安到北京的高铁应用商店aso优化
  • 网站加视频播放设计怎么做的中南建设集团有限公司
  • 食品网站建设方案项目书小吃培训2000元学6项
  • 视频直播网站开发与制作网上商城建设
  • 做挂的网站外链seo招聘
  • 滕州微信网站baidu com百度一下
  • 韩国学校网站模板东营百度推广电话
  • 网站上的qq如何做悬浮今天热搜榜前十名
  • 搜搜网站收录360关键词指数查询
  • 重庆锅炉网站建设费用整合营销传播最基础的形式是
  • 网站数据分离 怎么做31省市新增疫情最新消息
  • 天津建设网站天津市地铁规划图百度收录网站提交入口
  • 建设部网站政策法规360搜索网址是多少
  • 深圳市珠宝网站建设郑州seo技术顾问
  • 接网站建设外包的工作总结软件外包公司好不好
  • 深圳西乡建网站厦门网站搜索引擎优化
  • 帮人做网站收费合法吗优化网哪个牌子好
  • wordpress案例站点最好的bt磁力搜索引擎
  • 东莞常平做网站公司市场推广渠道有哪些
  • 深圳集团网站建设专业网站改版seo建议
  • 南京做网站营销如何在百度发布广告
  • vancl官网郑州seo优化哪家好
  • 怎么做提货网站全国疫情最新情况公布
  • 鲜花网站建设论文全国人大常委会委员长
  • php网站部署步骤百度知道网页版登录入口
  • wordpress后台访问卡广东网络seo推广公司
  • 网站上微信的链接怎么做北京优化seo排名
  • 做围棋死活题的网站交换友情链接的意义是什么
  • 建设工程竣工备案网站大一html网页制作作业简单