Coder Social home page Coder Social logo

请问一下为什么我打包后module里面的packaged_res已经转换为了webp,但是最终apk里面却还是png? about mcimage HOT 10 CLOSED

smallsohosolo avatar smallsohosolo commented on May 27, 2024
请问一下为什么我打包后module里面的packaged_res已经转换为了webp,但是最终apk里面却还是png?

from mcimage.

Comments (10)

smallSohoSolo avatar smallSohoSolo commented on May 27, 2024

某个module 需要单独apply plugin 就行了,支持的,可以检查一下是否使用正确,另外是否魔改了gradle

from mcimage.

leigao109 avatar leigao109 commented on May 27, 2024

不知道为什么在本地打包的时候最终apk图片没有改变,但是用Jenkins打包发现转为WebP 了。另外支持assets文件夹里面的图片进行压缩吗?

from mcimage.

yezhichao avatar yezhichao commented on May 27, 2024

遇到了一样的问题,看各个module/build/intermediates/packaged_res/ 里面的图片都已经转换了,但是打出来的debug包一看全是png

from mcimage.

biginsect avatar biginsect commented on May 27, 2024

@yezhichao
McImageConfig {
isCheckSize true //是否检测图片大小,默认为true
optimizeType "ConvertWebp" //优化类型,可选"ConvertWebp","Compress",转换为webp或原图压缩,默认Compress,使用ConvertWep需要min sdk >= 18.但是压缩效果更好
enableWhenDebug true //debug下是否可用,default true
isCheckPixels true // 是否检测大像素图片,default true
maxWidth 1000 //default 1000 如果开启图片宽高检查,默认的最大宽度
maxHeight 1000 //default 1000 如果开启图片宽高检查,默认的最大高度
whiteList = [ //默认为空,如果添加,对图片不进行任何处理
"icon_launcher.png"
]
mctoolsDir "$rootDir"
isSupportAlphaWebp true //是否支持带有透明度的webp,default false,带有透明图的图片会进行压缩
multiThread true //是否开启多线程处理图片,default true
bigImageWhiteList = ['ic_mi_tv.png','ic_mi_tv_state.png','home_ad_1.png','top_tv_bg.png'] //默认为空,如果添加,大图检测将跳过这些图片
}

我配置是这样的,但是项目里面的PNG并没有在打包的时候转成webp,不知道是哪里出了问题。

from mcimage.

yezhichao avatar yezhichao commented on May 27, 2024

@biginsect
module/build/intermediates/packaged_res/debug/ 这里面的drawable目录里图片有转换成webp吗?

from mcimage.

biginsect avatar biginsect commented on May 27, 2024

@yezhichao 我写了一个小demo 部分系统自带的png确实被转成了webp,但是我从别的地方拿过来的图片就没有转,提示
[Webp][E:\android demo\ImageOptimizationDemo\app\src\main\res\drawable-xxhdpi\icon_picture.png][oldInfo: 181899][newInfo: 0]。。
实在是不清楚哪里配置错了

from mcimage.

smallSohoSolo avatar smallSohoSolo commented on May 27, 2024

debug 被过滤了,请用release 尝试,另外配置里面有debug是否过滤,这个默认是过滤,大佬们看下是否正确

from mcimage.

yanchunlan avatar yanchunlan commented on May 27, 2024

我也遇到了一样的问题

from mcimage.

nianzixin avatar nianzixin commented on May 27, 2024

我也遇到了一样的问题,按照文档接入了,直接run的包和jenkins的包都没有转成webP

from mcimage.

smallSohoSolo avatar smallSohoSolo commented on May 27, 2024

统一回复,assets 里面没有进行转换,原因是assets 过于灵活,转换风险高

from mcimage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.