Giter Site home page Giter Site logo

Comments (4)

imhoffd avatar imhoffd commented on May 9, 2024

The Ionic API uses imagemagick at lower quality settings. The images produced by sharp are actually much better, because as you pointed out the PNG quality defaults to 100. I think it'd be a great idea to pass in PNG options in the programmatic API. Maybe also a --quality parameter, which is likely going to be the most used option.

from capacitor-assets.

chorpler avatar chorpler commented on May 9, 2024

Yes, the images produced by cordova-res are definitely noticeably less fuzzy than those produced by the Ionic API. I got a preliminary version working last night (programmatic API only -- I forgot about the CLI, whoops) but passing in different values for quality didn't actually seem to change anything; the output files were identical.

Setting the adaptiveFiltering option to true brought the size down a tiny bit, so it seemed to be passing the options in successfully, it just wasn't having the effect I thought it would...

Still trying to figure out what's going on ... πŸ€”

from capacitor-assets.

chorpler avatar chorpler commented on May 9, 2024

I figured out that the problem was obvious: the default libvips that sharp uses doesn't come with libimagequant enabled. I was able to get it to build with libimagequant on Linux, but not on Windows, which is where I do most of my development. With the libimagequant-including libvips installed, my changes worked fine in the Linux version. But I still can't get it to build properly in Windows. None of the Windows builds for libvips include libimagequant in the configuration, and although I can build libimagequant on its own under Windows, I haven't yet been able to build libvips with libimagequant support.

from capacitor-assets.

imhoffd avatar imhoffd commented on May 9, 2024

@chorpler It's slightly concerning that Ionic devs might need to compile their own libraries just to get reasonably sized images on Windows. This utility is becoming the default in CLI 5.0.0 as you may know. I was looking over the issues on the sharp repo for this and it sounds like there isn't a good solution. Will Windows builds for libvips include libimagequant any time soon?

I made a separate issue for the quality option BTW: #13

from capacitor-assets.

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.