Bad image quality with CarrierWave

502 Views Asked by At

I want to create the ability for the user to upload an image into a pdf which will be generated inside of the app. To do so I'm using gem prawn to pdf creation and CarrierWave::MiniMagic to create thumbnail versions of images for a Rails 6 app, and I've noticed loss of quality when the images are downsized.

original image:

original

the same image inside of pdf:

pdf

Such a bad quality is not acceptable for me. I don't know if it's a common problem but I've found a few posts without any resolution, is there any alternative solution/tool to handle it? I have been struggling with this problem for weeks.

I don't have nothing special in my uploader file:

class LogoUploader < CarrierWave::Uploader::Base
  include CarrierWave::MiniMagick

  EXTENSION_WHITELIST = %w[jpg jpeg png].freeze

  storage :file

  process convert: 'png'

  version :thumb do
    process resize_to_fit: [300, 300]
  end

  def extension_whitelist
    EXTENSION_WHITELIST
  end
end
0

There are 0 best solutions below