Convert considering image DPI
Posted: 2018-11-09T07:04:20-07:00
Hello,
I have written (thanks to your forum) a command line that convert an image to a jpeg file in 2000.3000px or in 3000.2000px depending on the orientation of the image.
Here is the command (where filename will automatically be replaced by the name of the master) :
- if the master file (TIF, JPG or PNG) dimension is smaller than 3000 for the bigger side and the resolution = 300 dpi:=>then the "JPG HD rendition" must keep the same dimension as the master file
- if the master file (TIF, JPG or PNG) resolution is over 72 dpi and under 300 dpi:=> the "JPG HD rendition" must keep the same dimension and resolution as the master file
- if the master file (TIF, JPG or PNG) resolution is under 72 dpi:=> the "JPG HD rendition" must keep the same dimension and resolution as the master file
Is there fonctions to check image dpi ?
Do you think it's possible to match those requirement with one magick command ?
I'm currently using ImageMagick 7.0.8-7 on a linux server.
Many thanks by advance,
Regards,
MisterJpa
I have written (thanks to your forum) a command line that convert an image to a jpeg file in 2000.3000px or in 3000.2000px depending on the orientation of the image.
Here is the command (where filename will automatically be replaced by the name of the master) :
The customer does now submit this new constraint for my 3000x3000 image generation :magick ${filename} -resize "[fx:w>h?3000:2000]x%[fx:w>h?2000:3000]" rendition.3000.3000.jpg
- if the master file (TIF, JPG or PNG) dimension is smaller than 3000 for the bigger side and the resolution = 300 dpi:=>then the "JPG HD rendition" must keep the same dimension as the master file
- if the master file (TIF, JPG or PNG) resolution is over 72 dpi and under 300 dpi:=> the "JPG HD rendition" must keep the same dimension and resolution as the master file
- if the master file (TIF, JPG or PNG) resolution is under 72 dpi:=> the "JPG HD rendition" must keep the same dimension and resolution as the master file
Is there fonctions to check image dpi ?
Do you think it's possible to match those requirement with one magick command ?
I'm currently using ImageMagick 7.0.8-7 on a linux server.
Many thanks by advance,
Regards,
MisterJpa