We are using FFMPEG in our java application and I am trying to convert a tiff file to jpg but the requirement is to keep the SAME DPI as it has in original tiff file.
I am new to FFMPEG and tried following failed attempts to achieve this:
ffmpeg -y -i test.tif test.jpg
: Successfully converted to jpg but DPI has reduced from 300 to 96. (Verified by pressing Right click on image --> properties--> details tab --> horizontal and vertical resolution attributes)ffmpeg -y -i test.tif -c:v copy test.jpg
: Converted to jpg with 300 dpi but actual file format is still tif. It seems like only extension is changed to jpg.ffmpeg -y -i test.tif -pix_fmt <format> test.gif
(tried all 3 supported format:yuvj420p,yuvj422p yuvj444p): Converted to jpg but dpi is changed from 300 to 96.ffmpeg y -i test.tif -r 1 -q:v <range> test.jpg
(tried various range: 1 to 10): Same problem.Tried
-q:v
and-qscale
options, but it's just changing the width and height of image.
Finally I heard about ImageMagick and problem is solved in first attempt by using following command:
magick convert "test.tif" "test.jpg"
: converted to jpg and dpi is 300.
Is it possible to achieve the same using FFMPEG. If yes, kindly assist me as I am stuck here for the long time.