<commit_before># Copyright 2012 <NAME> <<EMAIL>>
#
# This file is part of the Pykeg package of the Kegbot project.
# For more information on Pykeg or Kegbot, see http://kegbot.org/
#
# Pykeg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Pykeg is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Pykeg.  If not, see <http://www.gnu.org/licenses/>.

from imagekit.models import ImageSpec
from imagekit.processors import Adjust
from imagekit.processors import resize

if hasattr(resize, 'Fit'):
  ResizeToFit = resize.Fit
  Crop = resize.Crop
else:
  ResizeToFit = resize.ResizeToFit
  from imagekit.processors import crop
  Crop = crop.Crop


resized = ImageSpec(
    processors=[ResizeToFit(1024, 1024)],
    image_field='image',
    format='PNG',
)

small_resized = ImageSpec(
    processors=[ResizeToFit(256, 256)],
    image_field='image',
    format='PNG',
)

thumbnail = ImageSpec(
    processors=[Adjust(contrast=1.2, sharpness=1.1), Crop(256, 256)],
    image_field='image',
    format='PNG',
)

small_thumbnail = ImageSpec(
    processors=[Adjust(contrast=1.2, sharpness=1.1), Crop(64, 64)],
    image_field='image',
    format='PNG',
)<commit_msg>core: fix image specs now that imagekit 2.0 is required<commit_after># Copyright 2012 <NAME> <<EMAIL>>
#
# This file is part of the Pykeg package of the Kegbot project.
# For more information on Pykeg or Kegbot, see http://kegbot.org/
#
# Pykeg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Pykeg is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Pykeg.  If not, see <http://www.gnu.org/licenses/>.

from imagekit.models import ImageSpec
from imagekit.processors import Adjust
from imagekit.processors import resize

resized = ImageSpec(
    processors=[resize.ResizeToFit(1024, 1024)],
    image_field='image',
    format='PNG',
)

small_resized = ImageSpec(
    processors=[resize.ResizeToFit(256, 256)],
    image_field='image',
    format='PNG',
)

thumbnail = ImageSpec(
    processors=[Adjust(contrast=1.2, sharpness=1.1), resize.SmartResize(128, 128)],
    image_field='image',
    format='PNG',
)

small_thumbnail = ImageSpec(
    processors=[Adjust(contrast=1.2, sharpness=1.1), resize.SmartResize(32, 32)],
    image_field='image',
    format='PNG',
)
{'fraction_non_alphanumeric': 0.10141206675224647, 'fraction_numerical': 0.024390243902439025, 'mean_word_length': 4.374137931034483, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5267231', 'n_tokens_mistral': 1029, 'n_tokens_neox': 947, 'n_words': 349}