转跳到内容

所有动态

此流会自动更新

  1. 过去一个小时
  2. 是这样的,我也是试了很久才发现的
  3. 想出村需要招募人手可能需要问问管理呢
  4. 这就是残酷的现实吗。 我也注意到了,很多内联样式会失踪.....
  5. 论坛用不了css内联样式表,所以动态应该是实现不了
  6. 极限一定会被突破的! 虽然我没有思路,但是我相信后生可畏!
  7. 如果完善了可以去综合事务所发部,之前的一些脚本就发在那
  8. 确实是不想用也得用
  9. 我要速通穿越!没有障碍能阻挡我。 可惜同盟的每日签到系统不是点击特定按钮签到,而是回复指定帖子签到。 很多论坛的每日签到系统有Bug,只要在极短时间内签到多次,就能绕过每日签到只有一次的限制.......
  10. 论坛还是有极限的
  11. 请问出新手村去哪个板块招募比较好呢
  12. 真的是太冷了魔法攻击
  13. 买游戏真的很爽虽然好多入库再也没玩过
  14. 笑死了那和我多多引用回复吧
  15. 正在头脑风暴中 比如我们可以在图表的背景图片中藏一段文字,这样直接读HTML就读不出来了。 Kris神教是真的!
  16. 那可真是令人开心啊 能在返乡申请回来但不能发帖和其他非新人聊天 有的,不过没活动期间要特别肝,有活动的话就容易多了
  17. 现在没有啥表达欲也 有的话不用说也会去发的啦 新年快乐袜
  18. 就什么测体重然后每天按比例吃多少多少克碳水蔬菜蛋白质,然后都是白水煮菜煮肉这种不调味的极端。动画还没有学习,因为游戏很好玩。
  19. 是的,刚写的! 为了表达我对你的排版技术的憧憬,我抱着热情写下了这个脚本。 不过失败了很多次...... 这个论坛会给表格加很多CSS Style,所以需要调试。
  20. 好开心! 这个游戏好好玩,以后可不可以做类似的解密企划?隐藏一段秘密,解密即可获得奖励。
  21. 希望新的一年身体都好,各位都能找到属于自己爱的人
  22. 这是今天刚写的吗
  23. 和KE他们玩吧,凯那家伙一个月前就说要打联盟,现在都没组成车队,看看这周末有没有时间了
  24. 诈骗失败 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)
  1. 加载更多动态
×
×
  • 新建...

重要消息

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