Ask Your Question
0

Image size changed

asked 2013-05-11 13:21:22 -0600

baila gravatar image

hi all

i am facing a trouble while loading an image and after that saving it! The image size gets bigger after saving the image. Also the image data get modified. What should i do?

Thanks in advance!

edit retag flag offensive close merge delete

Comments

1

bigger, as in "more bytes" or as in "width/height" ?

what does "modified" mean ?

what language is that ? python ?

berak gravatar imageberak ( 2013-05-11 13:33:18 -0600 )edit

Please answer berak's questions - maybe it's just because of a different compression rate...

Guanta gravatar imageGuanta ( 2013-05-11 16:21:37 -0600 )edit

@berak

bigger means "more bytes". I am using openCV with C++ with visual studio 2012 ultimate.

baila gravatar imagebaila ( 2013-05-12 00:07:56 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-05-12 04:12:25 -0600

berak gravatar image

it seems, you want to mess with the compression params when saving.

here's it for png:

vector<int> flags; 
flags.push_back(CV_IMWRITE_PNG_COMPRESSION);
flags.push_back(9);  // [0-9] 9 being max compression, default is 3
imwrite("frame.png",frame,flags);

or jpeg:

vector<int> flags; 
flags.push_back(CV_IMWRITE_JPEG_QUALITY);
flags.push_back(99); // [0-99]   99==max_quality==no_compression
imwrite("frame.jpg",frame,flags);
edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-05-11 13:21:22 -0600

Seen: 258 times

Last updated: May 12 '13