photoprism/internal/config/config_convert.go
Michael Mayer 0e032295db Advanced Settings: Add ImageMagick, PNG, and vectors options #2207
This also improves the help texts of existing config options.

Signed-off-by: Michael Mayer <michael@photoprism.app>
2023-02-19 16:42:19 +01:00

53 lines
1.5 KiB
Go

package config
// VectorEnabled checks if indexing and conversion of vector graphics is enabled.
func (c *Config) VectorEnabled() bool {
return !c.DisableVectors()
}
// RsvgConvertBin returns the rsvg-convert executable file name.
func (c *Config) RsvgConvertBin() string {
return findBin(c.options.RsvgConvertBin, "rsvg-convert")
}
// RsvgConvertEnabled checks if rsvg-convert is enabled for SVG conversion.
func (c *Config) RsvgConvertEnabled() bool {
return !c.DisableVectors()
}
// ImageMagickBin returns the ImageMagick "convert" executable file name.
func (c *Config) ImageMagickBin() string {
return findBin(c.options.ImageMagickBin, "convert")
}
// ImageMagickBlacklist returns the ImageMagick file extension blacklist.
func (c *Config) ImageMagickBlacklist() string {
return c.options.ImageMagickBlacklist
}
// ImageMagickEnabled checks if ImageMagick can be used for converting media files.
func (c *Config) ImageMagickEnabled() bool {
return !c.DisableImageMagick()
}
// JpegXLDecoderBin returns the JPEG XL decoder executable file name.
func (c *Config) JpegXLDecoderBin() string {
return findBin("", "djxl")
}
// JpegXLEnabled checks if JPEG XL file format support is enabled.
func (c *Config) JpegXLEnabled() bool {
return !c.DisableImageMagick()
}
// DisableJpegXL checks if JPEG XL file format support is disabled.
func (c *Config) DisableJpegXL() bool {
if c.options.DisableJpegXL {
return true
} else if c.JpegXLDecoderBin() == "" {
c.options.DisableJpegXL = true
}
return c.options.DisableJpegXL
}