Skip to content

Commit

Permalink
Add new strip_exif filter in order to remove exif on demand
Browse files Browse the repository at this point in the history
  • Loading branch information
m-breen authored and franek committed Jun 28, 2017
1 parent 2e9b909 commit 002fc6f
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions debian/thumbor.conf
Expand Up @@ -166,6 +166,7 @@ ALLOW_UNSAFE_URL = True
#'thumbor.filters.equalize',
#'thumbor.filters.fill',
#'thumbor.filters.sharpen',
#'thumbor.filters.strip_exif',
#'thumbor.filters.strip_icc',
#'thumbor.filters.frame',
#'thumbor.filters.grayscale',
Expand Down
1 change: 1 addition & 0 deletions docs/documentation_structure.txt
Expand Up @@ -53,6 +53,7 @@ Index (* About)
* Rotate
* Round corners
* Sharpen
* Strip exif
* Strip icc
* Watermark
Releases
Expand Down
1 change: 1 addition & 0 deletions docs/filters.rst
Expand Up @@ -36,6 +36,7 @@ Filters
rotate
round_corners
sharpen
strip_exif
strip_icc
upscale
watermark
22 changes: 22 additions & 0 deletions docs/strip_exif.rst
@@ -0,0 +1,22 @@
Strip EXIF
=========

Usage: strip\_exif()

Description
-----------

This filter removes any Exif information in the resulting image.
This is useful if you have set the configuration PRESERVE_EXIF_INFO = True but still wish to overwrite this behavior in some cases
(e.g. for image icons)


Arguments
---------

No arguments

Example
-------

`<http://localhost:8888/unsafe/filters:strip\_exif()/http://www.arte.tv/static-epgapi/057460-011-A.jpg>`_
1 change: 1 addition & 0 deletions integration_tests/urls_helpers.py
Expand Up @@ -75,6 +75,7 @@
'filters:round_corner(20,255,255,100)',
'filters:sharpen(6,2.5,false)',
'filters:sharpen(6,2.5,true)',
'filters:strip_exif()',
'filters:strip_icc()',
'filters:watermark(rgba-interlaced.png,10,10,50)',
'filters:watermark(rgba-interlaced.png,center,center,50)',
Expand Down
1 change: 1 addition & 0 deletions tests/test_config.py
Expand Up @@ -69,6 +69,7 @@ def get_config(self):
'thumbor.filters.equalize',
'thumbor.filters.fill',
'thumbor.filters.sharpen',
'thumbor.filters.strip_exif',
'thumbor.filters.strip_icc',
'thumbor.filters.frame',
'thumbor.filters.grayscale',
Expand Down
1 change: 1 addition & 0 deletions thumbor/config.py
Expand Up @@ -308,6 +308,7 @@
'thumbor.filters.equalize',
'thumbor.filters.fill',
'thumbor.filters.sharpen',
'thumbor.filters.strip_exif',
'thumbor.filters.strip_icc',
'thumbor.filters.frame',
'thumbor.filters.grayscale',
Expand Down
3 changes: 3 additions & 0 deletions thumbor/engines/__init__.py
Expand Up @@ -348,6 +348,9 @@ def enable_alpha(self):
def image_data_as_rgb(self, update_image=True):
raise NotImplementedError()

def strip_exif(self):
pass

def strip_icc(self):
pass

Expand Down
3 changes: 3 additions & 0 deletions thumbor/engines/json_engine.py
Expand Up @@ -97,6 +97,9 @@ def paste(self, other_engine, pos, merge=True):
def enable_alpha(self):
return self.engine.enable_alpha()

def strip_exif(self):
return self.engine.strip_exif()

def strip_icc(self):
return self.engine.strip_icc()

Expand Down
3 changes: 3 additions & 0 deletions thumbor/engines/pil.py
Expand Up @@ -378,3 +378,6 @@ def enable_alpha(self):

def strip_icc(self):
self.icc_profile = None

def strip_exif(self):
self.exif = None
18 changes: 18 additions & 0 deletions thumbor/filters/strip_exif.py
@@ -0,0 +1,18 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki

# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com

from thumbor.filters import BaseFilter, filter_method


class Filter(BaseFilter):

@filter_method()
def strip_exif(self):
self.engine.strip_exif()
1 change: 1 addition & 0 deletions thumbor/thumbor.conf
Expand Up @@ -176,6 +176,7 @@ ALLOW_UNSAFE_URL = True
#'thumbor.filters.fill',
#'thumbor.filters.saturation',
#'thumbor.filters.sharpen',
#'thumbor.filters.strip_exif',
#'thumbor.filters.strip_icc',
#'thumbor.filters.frame',
#'thumbor.filters.grayscale',
Expand Down

0 comments on commit 002fc6f

Please sign in to comment.