TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Tell HN: Turn small images to html for fun

2 点作者 ff0066mote将近 15 年前
<i>I just made this small thing for fun. Please enjoy! I place it in the public domain. Python code follows. (Sorry about the newlines not coming through)</i><p>from sys import argv from base64 import b64encode from os.path import split, splitext<p>ifn = argv[1] alt, ext = splitext(ifn) ext = ext.lstrip('.') ofn = alt+'.html' alt = split(alt)[1]<p>ifd = open(ifn, 'rb') ofd = open(ofn, 'wb')<p>ofd.write( '&#60;img src="data:image/{0};base64,{1}" alt="{2}" /&#62;'.format(ext, b64encode(ifd.read()), alt))<p>ifd.close() ofd.close()

1 comment

aufreak3将近 15 年前
Gimp lets you export images into HTML tables :) It even asks you whether you're sane and really want to do it!
评论 #1435320 未加载