I need to resize an image in rmagick from its current size to a fixed width to a width of 300 without losing image quality. Currently I am doing following for a jpg image
if previewImage.columns > 300 previewImage.change_geometry!("300x") { |cols, rows, img| img.resize!(cols, rows) } end
am not sure if this the best way as I am losing sharpness in the resulting image. I want to be able to resize by losing the least amount of image quality.
I know there are filters and compression techniques: JPG JPEGCompression, LosslessJPEGCompression
but don't know which would provide the best result or could i convert the image to png and then resize?