I am versionning users files into a 85% quality JPEG with Shrine and VIPS.
Though it’s not the most efficient in my case if my user submits an image with a quality lower than 85%: the resulting image will be heavier but won’t have a better quality.
A good fix would be to retrieve the original image quality value and comparing it against the quality used for versionning ?
With ImageMagick we can do an “identify” but it returns more information than just the quality. (Maybe I could try to parse this string though)
Has someone done something similar ?
EDIT : MiniMagick seems to have easy access to Image magick identify function
I tried the follow :
orig_quality = ImageProcessing::MiniMagick.source(original).data["quality"].to_i
but I get error
2020-06-25T17:48:41.247Z pid=10705 tid=goweisxop WARN: TypeError: can’t convert ImageProcessing::Builder to Integer (ImageProcessing::Builder#to_int gives ImageProcessing::Builder)
(I am trying to use the original image quality above as versionning dimension so I know it works …)