To set the default quality to 100 for the Linux convert command (part of the ImageMagick suite), you have a few options:
-quality Option DirectlyYou can specify the quality for each command:
bashconvert input.jpg -quality 100 output.jpg
policy.xmlTo make 100 the default quality for all convert operations, you can modify ImageMagick's policy configuration file:
Open the policy file (location may vary by distribution):
bashsudo nano /etc/ImageMagick-6/policy.xml
(Replace 6 with your ImageMagick version if different.)
Locate or add the following line inside the <policymap> section:
xml<policy domain="coder" name="quality" value="100"/>
Save the file and restart any services using ImageMagick.
For a user-specific solution, add an alias to your shell configuration file (e.g., ~/.bashrc or ~/.zshrc):
bashalias convert='convert -quality 100'
Then reload your shell:
bashsource ~/.bashrc # or source ~/.zshrc
Set the MAGICK_QUALITY environment variable for your current session:
bashexport MAGICK_QUALITY=100
This will apply to all subsequent convert commands in that session.
Note: The policy.xml method is system-wide, while aliases and environment variables are user-specific. Choose the method that best fits your needs!