知识库 · AI 编程
AI 开发图片压缩小程序(1000用户)
用Cursor 2分钟开发图片压缩微信小程序,上线后24小时获1059 UV。分享AI编程核心在于需求描述与审美设计能力,未来编程门槛将大幅降低,强调执行力与抢占生态位的重要性。
AI 开发图片压缩小程序(1000用户)
2025年7月20日修改
大家好,我是小林,上周日在北京组了个 AI 编程的线下局,当场给来的观众展示了下怎么用 Cursor 做小程序,2 分钟就做出来个图片压缩的小程序。
当时就感觉功能很好用,晚上紧急半通宵上线了,早上起来利用 IP 优势推了一下,早上起来发现已经 1059 UV 了,来给大家深度分享一下近期我关于 AI 编程的思考。
春节用了 3 天做出小程序,上上周用了 1 小时,到今天只用几分钟,这里的迭代核心是我写需求文档能力在跃迁,能很快描述出来 Cursor 能理解的文字,这背后是大量的日积月累。
一、AI 编程需要编程能力吗?
当下如果你想做一款比较复杂的项目,多多少少还是要能看懂点代码,但是随着 Manus 之类的工具出现,我预估最多两年,编程能力几乎可以忽略了。
这里面最重要的有两个点:
一是挖掘需求的能力,你能做一款解决什么人群的什么需求,包括引流,引流的核心也一定是基于能解决用户需求,最终产生价值裂变,而不是所谓的黑科技裂变,未来各个平台对于引流都会卡的很严,因为流量越来越贵。
二是审美设计能力,不然 UI 这块没有灵魂,就像小米 su7 的模仿+创新,以及 iPhone 的划时代意义一样。
美学能力不同的人,即使同一个工具,产生的效果绝对天差地别。
腹有诗书气自华这句诗在 AI 编程格外的重要,你得拥有自己的产品灵魂。
1、AI 编程具体是什么呢?
AI 编程指的是通过 AI 工具,不写代码,或者少写代码实现你脑海里的想法。
这里面的难点是怎么将脑海里面的抽象逻辑具象化成 AI 能理解的文字。
小林我写作日更 7 年了,刚好擅长这个,发现没,元能力的积累在 AI 时代一样重要。
2、AI 编程工具推荐?
优先推荐 Cusor,目前体验最好的 AI 编程工具,就是需要付费。
如果你是零基础,除了 Cursor,国产 AI 工具,字节旗下的 Trae 可以考虑。
3、对于零基础小白而言,需要具备哪些能力和技能才能抓住这个机遇?
不需要特别复杂的能力和技能,要求非常简单,但是很少有人能长期坚持。
这个要求是:拉满执行力,当你有个好 idea 的时候,要立刻马上去实现,就说今天这个图片压缩的小程序,做出来那一刻我就很吃惊,当晚就折腾优化 UI、备案,部署上线,从做出来到将近 1000 UV,加起来都不到 24 小时。
未来工具的同质化会越来越严重,但是如果你能在前期就抢占生态位,就深入人心,当同质化那天来临,你已经吃到很多红利了,届时发挥你的审美设计能力,聚焦精力在微创新即可。
二、Cursor 开发图片压缩详解
灵感来源于线下组局读者提供的 idea,我当场实现。
一)项目初始化明确自己的需求
1、技术栈
前端:JavaScript+WXML+WXSS
后端:为节省成本和快速部署上线,直接砍掉后端。
2、核心功能
单独一个页面,页面要求有个上传图片的入口。
点击上传即可从相册中选择图片。
对于上传的图片要有个压缩图片的功能,压缩后的图片可以保存下载。
3、前期准备
提前注册好一个干净的微信小程序,如果可以的话,优先申请备案,备案是免费的,但是审核时间很长。
前期无需花 30 元申请认证,不认证的小程序也是可以部署上线的,但是无法搜索和转发,前期零成本试错先。
二)梳理 Cursor 能理解的需求文档
代码块
一个完整功能的微信小程序,要求使用 JavaScript 语言。
1、你是一名经验丰富的前端开发,且是设计科班出身,UI 也能设计很好。
2、我需要一个页面,页面有个上传图片的入口,点击上传即可从相册中选择图片,对于上传的图片要有个压缩图片的功能,压缩后的图片可以保存下载。
3、微信小程序的 appid 是 XXX梳理好之后,我直接创建个干净的文件夹,用 Cursor 打开,创建个 md 文档,将文字描述复制进来。
三)开发实操
使用 Cursor 的引用文件功能,引用需求文档,告知请根据文档里面的要求编写代码。
Cursor 会自动创建小程序所需要的文件。
用微信开发者工具打开根目录的文件夹:
点击编译看效果,结果出现了下述报错:
看报错是 images 文件夹下缺少 logo.png 图片。
回过头来看,发现 Cursor 给了说明:
原来是缺少两张图片,于是我用 AI 绘画工具画了两张图,放到指定位置,报错解决。
回到微信开发者工具,编译运行,又报错了,完全看不懂这个报错,遂截图提交给 Cursor 让它优化 bug。
这个 bug 我看不懂,总之 Cursor 成功帮我解决了。
最终页面预览效果如下:
至此第一个版本的小程序已经能使用了,于是我第一时间申请了提交代码。
这个版本的图片压缩有点 bug,如果压缩质量选择比较大,比如 90%,图片会出现反向压缩。
遂第二个版本重点优化这个 bug。
四)优化图片压缩 bug
直接截图+自然语言告知 Cursor:
出现这个 bug 的原因是:这些图片本身已经高度优化,或者格式本身就很高效。
可以理解成出现这个问题的用户不是真实用户,他们在随便测试玩,对于真实需求的用户几乎不可能出现这个问题。
所以 Cursor 给的解决方案是加个提醒:当用户尝试压缩已经很小的图片时,会收到适当的提示,避免不必要的操作和失望。
加上提醒功能,提交代码,等待审核通过。
五)Deepseek 优化小程序 UI
Cursor 设计的 UI 我感觉一般,接下来我让 deepseek 给我优化下。
准备好提示词:你是一名互联网高级 UI 设计师,我在做一款图片压缩的微信小程序,只有一个页面,请在不修改原意的情况下,请优化到炫酷一些,更加符合美学。
Cursor 写的页面样式:
代码块
page {
background-color: #f8f9fa;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.container {
display: flex;
flex-direction: column;
min-height: 100vh;
padding: 30rpx;
box-sizing: border-box;
}
/* 头部样式 */
.header {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 60rpx;
padding-top: 40rpx;
}
.logo {
width: 120rpx;
height: 120rpx;
margin-bottom: 20rpx;
}
.title {
font-size: 40rpx;
font-weight: 600;
color: #333;
margin-bottom: 10rpx;
}
.subtitle {
font-size: 28rpx;
color: #666;
}
/* 内容区域 */
.content {
flex: 1;
width: 100%;
}
/* 上传区域 */
.upload-area {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 400rpx;
background-color: #fff;
border-radius: 20rpx;
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
margin-bottom: 30rpx;
padding: 40rpx;
box-sizing: border-box;
border: 2rpx dashed #ddd;
}
.upload-icon {
width: 100rpx;
height: 100rpx;
margin-bottom: 30rpx;
}
.upload-text {
font-size: 32rpx;
font-weight: 500;
color: #333;
margin-bottom: 10rpx;
}
.upload-desc {
font-size: 24rpx;
color: #999;
}
/* 图片预览区域 */
.image-preview {
background-color: #fff;
border-radius: 20rpx;
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
padding: 30rpx;
box-sizing: border-box;
}
.preview-img {
width: 100%;
height: 400rpx;
border-radius: 10rpx;
margin-bottom: 30rpx;
}
.image-info {
margin-bottom: 30rpx;
padding: 20rpx;
background-color: #f8f9fa;
border-radius: 10rpx;
}
.info-item {
display: flex;
align-items: center;
margin-bottom: 10rpx;
}
.info-label {
font-size: 28rpx;
color: #666;
width: 160rpx;
}
.info-value {
font-size: 28rpx;
color: #333;
font-weight: 500;
}
.compression-rate {
font-size: 24rpx;
color: #3A7FED;
margin-left: 20rpx;
}
/* 质量滑块 */
.quality-slider {
margin-bottom: 30rpx;
background-color: #f8f9fa;
padding: 20rpx;
border-radius: 10rpx;
}
.slider-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
}
.slider-label {
font-size: 28rpx;
color: #666;
}
.slider-value {
font-size: 28rpx;
font-weight: 500;
color: #3A7FED;
background: rgba(58, 127, 237, 0.1);
padding: 4rpx 16rpx;
border-radius: 20rpx;
}
.quality-tips {
display: flex;
justify-content: space-between;
margin-top: 10rpx;
}
.quality-tip-text {
font-size: 24rpx;
color: #999;
}
/* 按钮组 */
.btn-group {
display: flex;
justify-content: space-between;
}
.btn {
flex: 1;
height: 80rpx;
border-radius: 40rpx;
font-size: 28rpx;
font-weight: 500;
display: flex;
align-items: center;
justify-content: center;
margin: 0 10rpx;
}
.btn:first-child {
margin-left: 0;
}
.btn:last-child {
margin-right: 0;
}
.reset-btn {
background-color: #f0f0f0;
color: #666;
}
.compress-btn {
background-color: #3A7FED;
color: #fff;
}
.save-btn {
background-color: #3A7FED;
color: #fff;
}
/* 底部 */
.footer {
padding: 30rpx 0;
text-align: center;
}
.footer-text {
font-size: 24rpx;
color: #999;
}
.logo-circle {
width: 120rpx;
height: 120rpx;
border-radius: 60rpx;
background-color: #3A7FED;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 20rpx;
}
.logo-text {
color: white;
font-size: 40rpx;
font-weight: bold;
}
.upload-icon-wrapper {
width: 100rpx;
height: 100rpx;
border-radius: 50rpx;
background-color: #f0f0f0;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 30rpx;
}
.upload-icon-text {
font-size: 60rpx;
color: #999;
line-height: 90rpx;
}
.small-image-tip {
margin-top: 16rpx;
padding: 10rpx;
background-color: rgba(255, 193, 7, 0.1);
border-radius: 8rpx;
}
.tip-text {
font-size: 24rpx;
color: #FF9800;
} Deepseek 优化后的 wxss:
代码块
/* 添加星空背景动画 */
@keyframes twinkle {
0% { opacity: 0.2; }
50% { opacity: 0.8; }
100% { opacity: 0.2; }
}
@keyframes float {
0% { transform: translateY(0); }
50% { transform: translateY(-10rpx); }
100% { transform: translateY(0); }
}
page {
background: linear-gradient(135deg, #1a1b3b 0%, #202442 50%, #161832 100%);
color: #FFFFFF;
font-family: 'PingFang SC', 'Helvetica Neue', Helvetica, 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
}
.container {
display: flex;
flex-direction: column;
min-height: 100vh;
padding: 30rpx;
box-sizing: border-box;
position: relative;
overflow: hidden;
}
/* 添加星星背景 */
.container::before {
content: '';
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image:
radial-gradient(2rpx 2rpx at 20% 30%, rgba(255, 255, 255, 0.8) 100%, transparent),
radial-gradient(2rpx 2rpx at 40% 70%, rgba(255, 255, 255, 0.7) 100%, transparent),
radial-gradient(2rpx 2rpx at 60% 20%, rgba(255, 255, 255, 0.9) 100%, transparent),
radial-gradient(2rpx 2rpx at 80% 50%, rgba(255, 255, 255, 0.6) 100%, transparent),
radial-gradient(3rpx 3rpx at 50% 80%, rgba(255, 255, 255, 0.8) 100%, transparent);
animation: twinkle 3s infinite alternate;
z-index: 0;
pointer-events: none;
}
/* 科技风格头部 */
.tech-header {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 60rpx;
padding-top: 40rpx;
position: relative;
}
.header-bg {
position: absolute;
top: 0;
left: -30rpx;
right: -30rpx;
height: 300rpx;
background: linear-gradient(135deg, rgba(0, 224, 255, 0.1), rgba(0, 71, 255, 0.1));
backdrop-filter: blur(10px);
border-bottom: 2rpx solid rgba(0, 224, 255, 0.3);
animation: gradientAnimation 10s ease infinite;
z-index: -1;
}
.logo-container {
position: relative;
margin-bottom: 20rpx;
}
.logo-circle {
width: 120rpx;
height: 120rpx;
border-radius: 60rpx;
background: linear-gradient(135deg, #00E0FF, #0047FF);
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 0 30rpx rgba(0, 224, 255, 0.8);
position: relative;
animation: float 3s ease-in-out infinite;
}
.logo-circle::after {
content: '';
position: absolute;
top: -10rpx;
left: -10rpx;
right: -10rpx;
bottom: -10rpx;
border-radius: 70rpx;
border: 2rpx solid rgba(0, 224, 255, 0.4);
box-shadow: 0 0 20rpx rgba(0, 224, 255, 0.4);
animation: pulse 2s infinite;
}
.logo-inner {
width: 100rpx;
height: 100rpx;
border-radius: 50rpx;
background-color: rgba(30, 30, 46, 0.8);
display: flex;
align-items: center;
justify-content: center;
}
.logo-text {
color: white;
font-size: 40rpx;
font-weight: bold;
text-shadow: 0 0 10rpx rgba(0, 224, 255, 0.8);
}
.title {
font-size: 40rpx;
font-weight: 600;
color: #FFFFFF;
margin-bottom: 10rpx;
letter-spacing: 2rpx;
}
.subtitle {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.7);
letter-spacing: 4rpx;
}
/* 内容区域 */
.content {
flex: 1;
width: 100%;
}
/* 上传区域 */
.upload-area {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 400rpx;
background: rgba(45, 45, 63, 0.3);
backdrop-filter: blur(10px);
border-radius: 20rpx;
margin-bottom: 30rpx;
padding: 40rpx;
box-sizing: border-box;
position: relative;
overflow: hidden;
border: 1rpx solid rgba(0, 224, 255, 0.2);
box-shadow: 0 8rpx 30rpx rgba(0, 0, 0, 0.2);
transition: all 0.3s ease;
}
.upload-area:active {
transform: scale(0.98);
box-shadow: 0 4rpx 15rpx rgba(0, 0, 0, 0.3);
}
.upload-border {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border: 2rpx dashed rgba(0, 224, 255, 0.5);
border-radius: 20rpx;
pointer-events: none;
}
.upload-icon-wrapper {
width: 100rpx;
height: 100rpx;
border-radius: 50rpx;
background: linear-gradient(135deg, #00E0FF, #0047FF);
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 30rpx;
box-shadow: 0 0 20rpx rgba(0, 224, 255, 0.4);
}
.upload-icon-text {
font-size: 60rpx;
color: #FFFFFF;
line-height: 90rpx;
}
.upload-text {
font-size: 32rpx;
font-weight: 500;
color: #FFFFFF;
margin-bottom: 10rpx;
}
.upload-desc {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.6);
}
/* 科技风格卡片 */
.tech-card {
background: rgba(45, 45, 63, 0.4);
backdrop-filter: blur(10px);
border: 1rpx solid rgba(0, 224, 255, 0.2);
box-shadow: 0 8rpx 30rpx rgba(0, 0, 0, 0.3),
inset 0 1rpx 1rpx rgba(255, 255, 255, 0.1);
border-radius: 20rpx;
padding: 30rpx;
box-sizing: border-box;
position: relative;
}
.card-corner {
position: absolute;
width: 20rpx;
height: 20rpx;
border-color: #00E0FF;
}
.top-left {
top: 0;
left: 0;
border-top: 2rpx solid;
border-left: 2rpx solid;
}
.top-right {
top: 0;
right: 0;
border-top: 2rpx solid;
border-right: 2rpx solid;
}
.bottom-left {
bottom: 0;
left: 0;
border-bottom: 2rpx solid;
border-left: 2rpx solid;
}
.bottom-right {
bottom: 0;
right: 0;
border-bottom: 2rpx solid;
border-right: 2rpx solid;
}
/* 图片预览区域 */
.preview-img {
width: 100%;
height: 400rpx;
border-radius: 10rpx;
margin-bottom: 30rpx;
border: 1rpx solid rgba(0, 224, 255, 0.3);
box-shadow: 0 0 20rpx rgba(0, 224, 255, 0.1);
}
.image-info {
margin-bottom: 30rpx;
padding: 20rpx;
background: rgba(30, 30, 46, 0.3);
backdrop-filter: blur(10px);
border-radius: 10rpx;
border-left: 4rpx solid #00E0FF;
box-shadow: inset 0 1rpx 1rpx rgba(255, 255, 255, 0.1);
}
.info-item {
display: flex;
align-items: center;
margin-bottom: 10rpx;
}
.info-label {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.7);
width: 160rpx;
}
.info-value {
font-size: 28rpx;
color: #FFFFFF;
font-weight: 500;
}
.compression-badge {
margin-left: 20rpx;
background: linear-gradient(135deg, #00E0FF, #0047FF);
border-radius: 20rpx;
padding: 4rpx 16rpx;
}
.compression-rate {
font-size: 24rpx;
color: #FFFFFF;
}
/* 质量滑块 */
.quality-slider {
margin-bottom: 30rpx;
background: rgba(30, 30, 46, 0.3);
backdrop-filter: blur(10px);
padding: 20rpx;
border-radius: 10rpx;
border: 1rpx solid rgba(0, 224, 255, 0.2);
}
.slider-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
}
.slider-label {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.7);
}
.quality-badge {
background: linear-gradient(135deg, #00E0FF, #0047FF);
border-radius: 20rpx;
padding: 4rpx 16rpx;
}
.slider-value {
font-size: 28rpx;
font-weight: 500;
color: #FFFFFF;
}
.quality-tips {
display: flex;
justify-content: space-between;
margin-top: 10rpx;
}
.quality-tip-text {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.5);
}
.small-image-tip {
margin-top: 16rpx;
padding: 10rpx;
background-color: rgba(255, 152, 0, 0.1);
border-radius: 8rpx;
border-left: 4rpx solid #FF9800;
}
.tip-text {
font-size: 24rpx;
color: #FF9800;
}
/* 按钮组 */
.btn-group {
display: flex;
justify-content: space-between;
}
.tech-btn {
flex: 1;
height: 80rpx;
border-radius: 40rpx;
font-size: 28rpx;
font-weight: 500;
display: flex;
align-items: center;
justify-content: center;
margin: 0 10rpx;
position: relative;
overflow: hidden;
border: none;
transition: all 0.3s ease;
}
.tech-btn::after {
border: none;
}
.btn-text {
position: relative;
z-index: 2;
}
.tech-btn:first-child {
margin-left: 0;
}
.tech-btn:last-child {
margin-right: 0;
}
.tech-btn:active {
transform: scale(0.95);
}
.reset-btn {
background-color: rgba(45, 45, 63, 0.8);
color: rgba(255, 255, 255, 0.8);
border: 1rpx solid rgba(255, 255, 255, 0.2);
}
.compress-btn, .save-btn {
background: linear-gradient(135deg, #00E0FF, #0047FF);
color: #FFFFFF;
box-shadow: 0 4rpx 15rpx rgba(0, 224, 255, 0.4),
inset 0 1rpx 1rpx rgba(255, 255, 255, 0.2);
}
/* 科技风格底部 */
.tech-footer {
padding: 30rpx 0;
text-align: center;
position: relative;
z-index: 1;
}
.footer-line {
height: 2rpx;
background: linear-gradient(to right,
transparent,
rgba(0, 224, 255, 0.2),
rgba(0, 224, 255, 0.8),
rgba(0, 224, 255, 0.2),
transparent
);
}
.footer-text {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.4);
letter-spacing: 2rpx;
background: linear-gradient(to right, #00E0FF, #0047FF);
-webkit-background-clip: text;
color: transparent;
text-shadow: 0 0 10rpx rgba(0, 224, 255, 0.3);
}
/* 动画效果 */
@keyframes pulse {
0% {
opacity: 1;
transform: scale(1);
}
50% {
opacity: 0.5;
transform: scale(1.05);
}
100% {
opacity: 1;
transform: scale(1);
}
}
.logo {
width: 120rpx;
height: 120rpx;
margin-bottom: 20rpx;
}
.upload-icon {
width: 100rpx;
height: 100rpx;
margin-bottom: 30rpx;
}
.logo-circle {
width: 120rpx;
height: 120rpx;
border-radius: 60rpx;
background-color: #3A7FED;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 20rpx;
}
.logo-text {
color: white;
font-size: 40rpx;
font-weight: bold;
}
.upload-icon-wrapper {
width: 100rpx;
height: 100rpx;
border-radius: 50rpx;
background-color: #f0f0f0;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 30rpx;
}
.upload-icon-text {
font-size: 60rpx;
color: #999;
line-height: 90rpx;
}
.small-image-tip {
margin-top: 16rpx;
padding: 10rpx;
background-color: rgba(255, 193, 7, 0.1);
border-radius: 8rpx;
}
.tip-text {
font-size: 24rpx;
color: #FF9800;
} 预览效果如下:
这个页面还是有点丑,所以又回到开头说的审美设计能力了,这里小林给大家演示一下,具体大家自己实践尝试。
相信看到这里的同学能看出来,这个小程序极其简单,从始至终我一行代码都没写,能很快跑出来,个人觉得我执行力还可以,hh,就这点值得去星球给贴子点个赞。(手动狗头)
三、小程序引流变现
引流变现是结果,是解决他人需求的回报,是给他人创造价值后的产物。
一)没有流量基础怎么做出有人使用的小程序?
周日线下局我给来的圈友分享了个思路:如果你的小程序是在解决某类人群的需求,完全可以在自媒体账号更新你做小程序的过程细节,类似于养成。
这个过程反而解决了自媒体内容创作的问题,万一哪篇笔记爆了,小程序的用户有了,你的 IP 也起来了。
据我观察,小红书目前是比较好的平台,近期小红书也在全力推独立开发大赛,有心人可以去关注一下。
二)零基础的普通人如何利用 AI 编程来变现?
小程序变现的最简单路径是赚平台的广告费,只需要 500 个用户即可开通流量主服务。
今天 AI 编程行动营开营还有人问:上线后能搞钱么? 后续运营需要钱和时间吗?
变现 AI 编程行动营会教的,教练可以保证百分百的交付诚意,但是能不能百分百执行就看大家自己了。
不能指望啥也不干,没有付出就躺赚,今天这个小程序我也是熬到凌晨 3 点才做到紧急上线的,想做成事得有付出,想清楚自己的筹码是什么。
结尾:
AI 编程工具确实让技术门槛断崖式下降,但真正让产品活起来的,还是那颗愿意为他人解决问题的心,以及你的超强执行力。