My application requires non-interlaced PNGs for certain instances. Is there a way to validate that an uploaded file is non interlaced?
I think there might be a way to do it, but you may have to use a image processing library like: https://github.com/libvips/ruby-vips - i do not think that shrine can help you out like that without an image processing library. given you can test for interlaced / non-interlaced photos, you can certainly validate using Shrine. this might help, although, i haven’t read it too closely: https://github.com/libvips/libvips/issues/931 - i’m pretty sure you can find your answer using image magick - the ruby implementation, but i have not had any experience doing it myself.
The processing plugin works OK to force the interlacing like this. But I am concerned about the position to deprecate the processing plugin in lieu of the derivatives. In our app we definitely want to process the original image with no need to keep the original and a derivative. Keeping the original would result in unnecessary demand on the storage layer.
process(:store) do |io, context| case io.mime_type when "image/png", "image/jpg" io.download do |orig| ImageProcessing::MiniMagick.source(orig).resize_to_limit(800, 800).interlace("none").call end end end