Streaming Progressive JPEGs didn't work
@Override public NewsEventHolder onCreateViewHolder(ViewGroup parent, int viewType) { SimpleProgressiveJpegConfig jpegConfig = new SimpleProgressiveJpegConfig(); jpegConfig.getNextScanNumberToDecode(1); jpegConfig.getQualityInfo(1);
ImagePipelineConfig config = ImagePipelineConfig.newBuilder(context)
.setProgressiveJpegConfig(jpegConfig)
.build();
Fresco.initialize(context,config);
View v = LayoutInflater.from(context).inflate(R.layout.item_news_event, parent, false);
return new NewsEventHolder(v);
}
@Override public void onBindViewHolder(NewsEventHolder holder, int position) { holder.txtTitle.setText(itemNewsEvents.get(position).getTitle()); holder.txtDate.setText(itemNewsEvents.get(position).getDate());
Uri myUri = Uri.parse(itemNewsEvents.get(position).getImg());
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(myUri)
.setProgressiveRenderingEnabled(true)
.build();
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setOldController(holder.draweeView.getController())
.build();
holder.draweeView.setController(controller);
}
What URI are you hitting?
https://img.okezone.com//content/2015/03/13/20/1117973/dirjen-pajak-blunder-soal-pajak-jalan-tol-Hhkw9dov48.jpg
The image has appeared in my RecyclerView but The Streaming progressive jpeg didn't work. It should have seen the quality of the image start out low and gradually become clearer.
I took a look at the image in a hex editor. I am not sure the contents of the file are correct.
A progressive JPEG should have a SOF2 marker (0xFFC2). Your image has a SOF0 marker (0xFFC0) which indicates it is a baseline image.
I do see that you have three SOS markers, which would be consistent with a progressive image with three scans. You may want to check the encoding of this image.
That image loaded in a baseline fashion for me as well. IT seems that the image is not a progressive jpeg. Not all jpegs are progressive.
I see, Thank you..
is there any library for making progressive jpeg in android ?
What do you mean by making a progressive jpeg? If you are downloading the image from network, then there is not much you can do if the image is not already in the progressive format, as you'd have to download it fully after which makes no sense transcoding it. If you'd like to save a local image as a progressive jpeg, we use lib-jpeg-turbo library under the hood, but I'm not sure whether it can produce the progressive jpegs or not. Even if it can, at the moment we don't expose this functionality. We can only read progressive jpegs. Keep in mind that even if you upload some progressive image from your phone to some server, there is a good chance that the server will transcode that image in which case it makes very little difference in what format you've sent the image.
is there any sample code for Streaming Progressive JPEG ?
i'm using this uri progressive jpeg and it still doesn't work http://pooyak.com/p/progjpeg/jpegload.cgi?o=1
Ok, I see. Yes, that image does load as a baseline.
I am working on fixing this bug.
Fixed in release 0.5.0
@tyronen hi, I suffered this bug too, and fix my app with release 0.5.0.But I look forward when the source code of 0.5.0 will be release~? Thx a log ~
The source of 0.5.0 is already released. From the repo, just select the tag v0.5.0.