How to export a image with approximate size [closed]
I hope to get a about 400kb GPEG image whatever the input image is any size. How to implement it? This is the current for test. Of curser, my image always grayscale,and the input image is alway greater 400kb.
:-P, actually not a homework somthing. I just don't start about it.. I don't beg for code,you can give me some hint. I will compose a code for it.. :) @LBerger
Sorry it's a mistake it was not your post. And about your problem i know only answer : 1 save image 2 get size 3 if size is greater than threshold decrease quality and goto 1
We have some disscuss here. we can calculate the compressed rate about the result image.But it is seem the OpenCV hard to do it. I have to say, it is not a easy problem. @LBerger
I don(t know what you want exactly but I think with imencode you can get image size before saving it to disk. Use imwrite flags to fixed compression quality