Convert bmp to linear jpeg [closed]

asked 2016-08-31 04:11:08 -0600

sadasir gravatar image

updated 2020-11-28 14:42:05 -0600

Hello,

I want to convert a bmp image to jpeg. But I want to be able to change the parameters of the jpeg image that is created. I want to use linear gamma, because i want to get linear jpeg in the end. Is there a function that does this in C++?

Thanks

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-11-28 14:42:14.851398

Comments

OpenCV uses file extension do encode/decode image file

cv::Mat img = imread("test.bmp");

//make all modification to img
...
imwrite("test.jpg",img);
pklab gravatar imagepklab ( 2016-08-31 04:59:56 -0600 )edit

Are you sure that the jpg image in the end will be LINEAR jpg? Because I already found a way to convert it but my bmp image is 80Mb and the jpg is only 2Mb

sadasir gravatar imagesadasir ( 2016-08-31 05:31:09 -0600 )edit

with make all modification to img I would say make gamma correction / linearisation. After this you can save as you want. For gamma correction See this or this

pklab gravatar imagepklab ( 2016-08-31 05:43:14 -0600 )edit

@sadasir, i've got the weird feeling, you're looking at the wrong library for this.

berak gravatar imageberak ( 2016-08-31 06:31:47 -0600 )edit

BTW, I would use the params optional parameter of imwrite and set the JPG compression to a bare minimum ... more info here!

StevenPuttemans gravatar imageStevenPuttemans ( 2016-09-01 04:57:48 -0600 )edit