Customize multiple progressive jpeg config in Fresco

185 views Asked by At

The progressive jpeg config can be setted when initializing Fresco.

ImagePipelineConfig config = ImagePipelineConfig.newBuilder(context)
    .setProgressiveJpegConfig(progressiveJpegConfig)
    .build();
Fresco.initialize(context, config);

Now I want to loading the progressive jpeg in different scan quality, is there any way to achieve it?

1

There are 1 answers

1
Alexander Oprisnik On

Unfortunately, this is not supported right now. However, a workaround that could help here:

  • Create a delegating progressive JPEG config
  • In Activity A, call delegate.setConfig(configA)
  • In Activity B, call delegate.setConfig(configB)

This is not a perfect solution and if there are still image request from A in flight while B is active, you might end up in an inconsistent state, but it should work.

For proper support, either the ProducerFactory, DecodeProducer or the PJPEG config would need to be changed on the Fresco side. Pull requests are always welcome.