Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove EXIF (camera) data from image with carrierwave?

Does anybody know? With paperclip there was a special config command.

Removing camera data from image keeps 25-30 Kb per file. It's very sensitive if we make a lot of versions (thumb, small...). In small images the actual size of file without this information can be 5-6 times less.

Thanks in advance!

like image 735
Voldy Avatar asked Jan 20 '11 22:01

Voldy


People also ask

Can EXIF data be removed?

Select the photos, then right-click and select “Properties.” Navigate to “Properties” to remove metadata from your photos. Once you're in the “Properties” window, click on the tab “Details.” Then click on “Remove Properties and Personal Information” at the bottom of the window.

Can you remove EXIF data in Lightroom?

In Lightroom, choose "Copyright Only" from the Metadata section dropdown while exporting an image to remove EXIF data (this will remove most of your data, but not copyright information, thumbnail, or dimensions). In Photoshop, you can use the Save for Web dialog to remove EXIF data.


1 Answers

Carrierwave is very flexible and it's possible to make own processors. With MiniMagick we can use a bunch of options of mogrify command-line utility, one of them is strip:

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

  version :small do
    process :resize_to_fill => [100, 100]
    process :strip
  end

  def strip
    manipulate! do |img|
      img.strip
      img = yield(img) if block_given?
      img
    end
  end
end
like image 56
Voldy Avatar answered Sep 20 '22 08:09

Voldy