Hi,
is it possible to force or limit the input format(s) for the console command convert?
For example only allow JPEG files and if its not a JPEG file don't do anything.
Does it make sense to do that?
Limit input format for convert
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Limit input format for convert
I think that is something best left to your server or interface software to avoid uploading or passing Imagemagick the offending formats.
In Im, you can disable some of the delegate libraries, such as PNG and TIFF and PDF (ghostscript), but GIF is internal and so probably cannot be disabled. I do not know about PSD. Perhaps the delegates.xml file can be modified to restrict use, but I would not know how to do that.
Alternately, you can write a simple script to check the image format and if not JPG, then do not call convert. That is the simplest approach, but the code depends upon your platform. See the string format "%m" at http://www.imagemagick.org/script/escape.php
Please always provide your IM version and platform, when asking questions on this forum, since syntax and scripting may differ.
In Im, you can disable some of the delegate libraries, such as PNG and TIFF and PDF (ghostscript), but GIF is internal and so probably cannot be disabled. I do not know about PSD. Perhaps the delegates.xml file can be modified to restrict use, but I would not know how to do that.
Alternately, you can write a simple script to check the image format and if not JPG, then do not call convert. That is the simplest approach, but the code depends upon your platform. See the string format "%m" at http://www.imagemagick.org/script/escape.php
Please always provide your IM version and platform, when asking questions on this forum, since syntax and scripting may differ.
Re: Limit input format for convert
See https://www.imagemagick.org/discourse-s ... =4&t=29588. You can disable all formats in the policy except JPEG. You can also delete the coder modules, except for JPEG, miff.so, png.so, tiff.so, etc.