转跳到内容

所有动态

此流会自动更新

  1. 过去一个小时
  2. 是的,刚写的! 为了表达我对你的排版技术的憧憬,我抱着热情写下了这个脚本。 不过失败了很多次...... 这个论坛会给表格加很多CSS Style,所以需要调试。
  3. 好开心! 这个游戏好好玩,以后可不可以做类似的解密企划?隐藏一段秘密,解密即可获得奖励。
  4. 希望新的一年身体都好,各位都能找到属于自己爱的人
  5. 这是今天刚写的吗
  6. 和KE他们玩吧,凯那家伙一个月前就说要打联盟,现在都没组成车队,看看这周末有没有时间了
  7. 诈骗失败 X2 前面一直在研究前辈和其他人的排版,然后就和Claude一起手搓了一个自动根据图片排版的Python脚本。 #!/usr/bin/env python3 """Convert an image to an HTML table where each cell represents a pixel.""" from PIL import Image import sys import os def image_to_html_table(image_path, output_path, width=120): """Convert an image to an HTML table. Args: image_path: Path to the input image output_path: Path for the output HTML file width: Target width in cells (height calculated to maintain aspect ratio) """ # Load the image img = Image.open(image_path) # Calculate new height to maintain aspect ratio aspect_ratio = img.height / img.width height = int(width * aspect_ratio) # Resize the image img = img.resize((width, height), Image.Resampling.LANCZOS) # Convert to grayscale img = img.convert('L') # Get pixel data pixels = list(img.getdata()) # Build HTML html = """<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Bad Apple - HTML Table</title> </head> <body> <table style="border-collapse:collapse;table-layout:fixed"> """ # Generate table rows for y in range(height): html += " <tr>" for x in range(width): pixel_value = pixels[y * width + x] # Convert grayscale to hex color hex_color = f"#{pixel_value:02x}{pixel_value:02x}{pixel_value:02x}" html += f'<td style="background-color:{hex_color};width:6px;height:6px;padding:0;line-height:0"></td>' html += "</tr>\n" html += """ </table> </body> </html> """ # Write output with open(output_path, 'w') as f: f.write(html) print(f"Generated HTML table: {output_path}") print(f"Dimensions: {width}x{height} cells") if __name__ == "__main__": if len(sys.argv) < 2: print("Usage: python image_to_table_v2.py <image_path> [width]") sys.exit(1) image_path = sys.argv[1] # Derive output path from input filename base_name = os.path.splitext(os.path.basename(image_path))[0] output_path = f"{base_name}_table.html" # Optional: accept width from command line width = int(sys.argv[2]) if len(sys.argv) > 2 else 120 image_to_html_table(image_path, output_path, width)
  8. 姑且还是买了,毕竟节操也没用了(不是
  9. 虽然我的XP偏向混沌,但是对于NTR只能接受可以选择被牛的程度,这个好像必定被牛 你这个图片是用什么作的,挺有趣的
  10. 给游戏氪金 买点游戏 剩下的可能就是买一些奇奇怪怪的收藏品
  11. 我的近视眼又加深了一点 我是第一个吗!? 我要尝试认领20节操!如果我是四个月第一个发现的人的话,能不能多给一些。
  12. 稍为看过一下版规了 谢谢~ 真的有人这么快就穿越吗 好好奇怎么做到的 话说出村后就不能再回来吗 我看到有返乡活动 但我没很了解就是了
  13. 恩恩 刚才大致上看过一遍了 谢谢啦~
  14. 好呀 我的第一次就献给你吧
  15. c10ud接下了每周任务:勇者杀敌——水怪的养成 1.https://sstm.moe/topic/377034-qq区的游戏号能不能转号/#findComment-18769080 2.https://sstm.moe/topic/377041-里面能干嘛呢?/#findComment-18770131 3.https://sstm.moe/topic/377062-大家现在看番是在线网站还是自己找资源下载?/#findComment-18772129 4.https://sstm.moe/topic/377062-大家现在看番是在线网站还是自己找资源下载?/#findComment-18773720 5.https://sstm.moe/topic/377101-第一次冷到手指甲都变紫/#findComment-18775091
  16. 元旦快乐。也是希望新的一年能够平平安安地度过。
  17. 今天
  18. 这天气确实难顶,我在广东也感受到了
  19. 新年快乐,愿论坛能够一直有活力。
  20. 新年快乐,希望我的女儿能健康长大,少哭多笑睡整觉。
  21. 先做出不会动的Bad Apple,才能做出会动的Bad Apple。 不过我怀疑静态效果可能是排版系统的极限了。这个系统似乎不支持动态效果,最后的结果只会一动不动。
  22. 元旦快乐! 愿那群鸽子做游戏快一点
  23. 突然去问有点尴尬来的 不过你用AI的频率怎么样,感觉最近AI进化的速度还蛮快的
  24. 依旧需要沉淀w 不然感觉会被踹飞(
  1. 加载更多动态
×
×
  • 新建...

重要消息

为使您更好地使用该站点,请仔细阅读以下内容: 使用条款