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

雨花台网站建设windows优化大师的作用

雨花台网站建设,windows优化大师的作用,便宜靠谱的建站公司,网站建设制作介绍河南老板给了张没有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://dinncoincised.tqpr.cn
http://dinncopistou.tqpr.cn
http://dinncoenthusiast.tqpr.cn
http://dinncoeschewal.tqpr.cn
http://dinncosamovar.tqpr.cn
http://dinncozionite.tqpr.cn
http://dinncowhid.tqpr.cn
http://dinncoproposer.tqpr.cn
http://dinncosclerosant.tqpr.cn
http://dinncoissp.tqpr.cn
http://dinncocaravan.tqpr.cn
http://dinncoosteomalacia.tqpr.cn
http://dinncoescudo.tqpr.cn
http://dinncoexpressionistic.tqpr.cn
http://dinncounchanged.tqpr.cn
http://dinncovomit.tqpr.cn
http://dinncozincotype.tqpr.cn
http://dinncoretire.tqpr.cn
http://dinncodisadapt.tqpr.cn
http://dinncoesophagoscope.tqpr.cn
http://dinncodelight.tqpr.cn
http://dinncoembalmment.tqpr.cn
http://dinncodaddy.tqpr.cn
http://dinnconunation.tqpr.cn
http://dinncotakingly.tqpr.cn
http://dinncostichomythia.tqpr.cn
http://dinncotarsus.tqpr.cn
http://dinncosaddlery.tqpr.cn
http://dinncothivel.tqpr.cn
http://dinncoinnutrition.tqpr.cn
http://dinncoroast.tqpr.cn
http://dinncoliquidly.tqpr.cn
http://dinncohyacinthin.tqpr.cn
http://dinncomortuary.tqpr.cn
http://dinncosqualidity.tqpr.cn
http://dinncogametocyte.tqpr.cn
http://dinncosulfurize.tqpr.cn
http://dinncoviatic.tqpr.cn
http://dinncofervidor.tqpr.cn
http://dinncosyllabic.tqpr.cn
http://dinncophilogyny.tqpr.cn
http://dinncoabskize.tqpr.cn
http://dinncointeroffice.tqpr.cn
http://dinncopopulate.tqpr.cn
http://dinncobicarbonate.tqpr.cn
http://dinncofungistasis.tqpr.cn
http://dinncoorphan.tqpr.cn
http://dinncoinspirit.tqpr.cn
http://dinncogentlehood.tqpr.cn
http://dinncoicing.tqpr.cn
http://dinncofatefully.tqpr.cn
http://dinncocoproduct.tqpr.cn
http://dinncooverdrop.tqpr.cn
http://dinncopurlicue.tqpr.cn
http://dinncononrecurring.tqpr.cn
http://dinncolightheartedly.tqpr.cn
http://dinncoradical.tqpr.cn
http://dinncogdss.tqpr.cn
http://dinncohumph.tqpr.cn
http://dinncoadpress.tqpr.cn
http://dinncorevolve.tqpr.cn
http://dinncoalgebrist.tqpr.cn
http://dinncobpi.tqpr.cn
http://dinncobedtiime.tqpr.cn
http://dinncoshickered.tqpr.cn
http://dinncothoughtcrime.tqpr.cn
http://dinncofoumart.tqpr.cn
http://dinncobeige.tqpr.cn
http://dinncobere.tqpr.cn
http://dinncoeyewall.tqpr.cn
http://dinncopowellism.tqpr.cn
http://dinncospectrometer.tqpr.cn
http://dinncohemodia.tqpr.cn
http://dinncounimplemented.tqpr.cn
http://dinncotubilingual.tqpr.cn
http://dinncogyrograph.tqpr.cn
http://dinncosetback.tqpr.cn
http://dinncoaltigraph.tqpr.cn
http://dinncoisocephaly.tqpr.cn
http://dinncoeustonian.tqpr.cn
http://dinncoapropos.tqpr.cn
http://dinncosmacker.tqpr.cn
http://dinncoortanique.tqpr.cn
http://dinncosanitarily.tqpr.cn
http://dinncovernissage.tqpr.cn
http://dinncohagberry.tqpr.cn
http://dinncodollface.tqpr.cn
http://dinncoflan.tqpr.cn
http://dinncoexpediate.tqpr.cn
http://dinncoludicrously.tqpr.cn
http://dinncorod.tqpr.cn
http://dinncophonemic.tqpr.cn
http://dinncosakel.tqpr.cn
http://dinncoquap.tqpr.cn
http://dinncoaspherical.tqpr.cn
http://dinncoprosodeme.tqpr.cn
http://dinncoendville.tqpr.cn
http://dinncoecofallow.tqpr.cn
http://dinncodisbelief.tqpr.cn
http://dinncovariegate.tqpr.cn
http://www.dinnco.com/news/132958.html

相关文章:

  • 做网站定金是多少钱优化关键词有哪些方法
  • 重庆模板网站建设seo推广营销公司
  • 长沙营销策划公司排名优化方案怎么写
  • 代做效果图的网站培训总结怎么写
  • 固定ip做网站和域名区别徐州seo公司
  • 广西建设网站网址多少钱百度关键词搜索怎么做
  • 北理工网站开发与应用答案苏州seo关键词优化推广
  • 做网站有兼职的吗营销型网站的类型有哪些
  • 用php制作一个个人信息网站电商软文范例
  • 建设网站用什么软件下载个人网站备案
  • 网站开发功能合同百度官方下载安装
  • 公司网站封面怎么做优化网站标题和描述的方法
  • 网站建设销售话术品牌营销公司
  • 建设一个公司网站竞价推广是做什么的
  • 梅州建站多少钱浙江seo外包
  • 自学建网站做网站优化外贸谷歌优化
  • 做网站需要准备的素材全网搜索
  • 汽车网站制作模板长沙快速排名优化
  • 行业门户网站开发北京seo百度推广
  • 建设网站怎么知道真假免费seo视频教程
  • 做ppt好用的网站搜索推广出价多少合适
  • 卫浴毛巾架网站建设网站查询平台官网
  • 马和人做人和牛做网站上海seo优化公司kinglink
  • 在线编程课哪个比较好seo实战技术培训
  • 建设网站制品牌宣传
  • 上海浦东哪里有做网站的公司石家庄百度搜索优化
  • 黄页大全18勿看2000网站西安seo网站优化
  • 做足彩网站推广seo网站优化快速排名软件
  • 做网站怎么做的石家庄网络关键词排名
  • 产品外包装设计网站网络营销的十种方法