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

地方网站做哪些内容百度网站的域名地址

地方网站做哪些内容,百度网站的域名地址,b2c购物系统,毕业设计医院网站设计怎么做因为我的一个项目是使用GitHub action来实现编译和部署的,而且这个android项目的icon很有可能会发生变化,所以需要在脚本中实现自动化生成icon的功能,所以这里就写了一个js脚本来做这个事情 这个脚本可以输入一个图片地址,然后生…

因为我的一个项目是使用GitHub action来实现编译和部署的,而且这个android项目的icon很有可能会发生变化,所以需要在脚本中实现自动化生成icon的功能,所以这里就写了一个js脚本来做这个事情

这个脚本可以输入一个图片地址,然后生成android项目的icon图标。

脚本文件内容:

const sharp = require('sharp')
const fs = require('fs-extra')
const path = require('path')
const { program } = require('commander')const DENSITIES = {mdpi: 48,hdpi: 72,xhdpi: 96,xxhdpi: 144,xxxhdpi: 192,
}program.requiredOption('-i, --input <file>', 'Path to source PNG').option('-o, --output <dir>', 'Output directory', 'res').option('--rounded', 'Apply circular mask to icons').option('--copy-to <androidResDir>', 'Copy icons to Android res directory')program.parse(process.argv)
const options = program.opts()async function generateAdaptiveIcons(input, outputDir) {for (const [dpi, size] of Object.entries(DENSITIES)) {const mipmapDir = path.join(outputDir, `mipmap-${dpi}`)await fs.ensureDir(mipmapDir)const foregroundPath = path.join(mipmapDir,'ic_launcher_foreground.png')const backgroundPath = path.join(mipmapDir,'ic_launcher_background.png')const legacyPath = path.join(mipmapDir, 'ic_launcher.png')const img = sharp(input).resize(size, size)const rounded = options.rounded? img.composite([{input: Buffer.from(`<svg><circle cx="${size / 2}" cy="${size / 2}" r="${size / 2}" fill="white"/></svg>`),blend: 'dest-in',},]): imgawait rounded.toFile(foregroundPath)await sharp({create: {width: size,height: size,channels: 4,background: '#FFFFFF',},}).png().toFile(backgroundPath)// legacy fallbackawait rounded.toFile(legacyPath)}// Generate XMLconst xmlPath = path.join(outputDir, 'mipmap-anydpi-v26')await fs.ensureDir(xmlPath)await fs.writeFile(path.join(xmlPath, 'ic_launcher.xml'),`
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"><background android:drawable="@mipmap/ic_launcher_background"/><foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>`.trim())await fs.writeFile(path.join(xmlPath, 'ic_launcher_round.xml'),`
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"><background android:drawable="@mipmap/ic_launcher_background"/><foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>`.trim())console.log('✅ Adaptive icons generated.')
};(async () => {const { input, output, copyTo } = optionsconst outPath = path.resolve(output)await generateAdaptiveIcons(input, outPath)if (copyTo) {const dest = path.resolve(copyTo)await fs.copy(outPath, dest, { overwrite: true })console.log(`📦 Icons copied to Android res dir: ${dest}`)}
})()

使用说明:

node ./generateIcons.cjs -i pakeplus.png --copy-to app/src/main/res

生成圆角图标:

node ./generateIcons.cjs -i pakeplus.png --rounded --copy-to app/src/main/res

最后生成的结果:

http://www.dtcms.com/wzjs/284566.html

相关文章:

  • 大型网站团队人数手机百度官网首页
  • 萝岗免费网站建设seo 优化 服务
  • 个人网站一定要备案吗电商运营公司排名
  • 抽奖网站怎么制作广告免费发布信息
  • 威海哪家网站做的好东莞搜索优化十年乐云seo
  • 深圳做网站网络公司怎么样论坛推广案例
  • 网站建设经济可行性报告千锋教育学费多少
  • 小区物业管理系统宁波超值关键词优化
  • java中建设网站怎么找一手app推广代理
  • 赣州网站seoseo查询系统
  • 网站引擎友好性分析app推广拉新平台
  • 网站开发 弹窗市场调研报告怎么写的
  • 山东住房城乡建设厅官方网站域名被墙查询
  • 做游戏用什么电脑系统下载网站好百度seo排名帝搜软件
  • 如何做网站热力图市场营销师报名官网
  • 做外贸什么网站比较好关键词是什么意思
  • 网站建设制作设计公司哪家好响应式网站建设
  • 做网站app要多钱可以发广告的100个网站
  • 微信公众号链接网站怎么做南京百度提升优化
  • 网站规划建设与管理维护课后答案6营销网站搭建
  • 下载网站如何做企业网站建设方案范文
  • 网站的客服怎么做爱站网站排名查询工具
  • 政府网站建设团队360seo排名优化服务
  • 东莞营销型网站外包2345网址导航电脑版官网
  • 江苏中禾建设网站网页制作
  • wordpress 小程序 插件企业seo顾问公司
  • 在线营销单页网站制作高效统筹疫情防控和经济社会发展
  • 门户网站建设 突出服务今日新闻最新
  • 找人做网站被骗属于诈骗吗seo科技网
  • 久久室内设计网seo网站分析工具