a164427074b09a19377ac8f94f71c8c5aa269e06,imagekit/processors/resize.py,ResizeCanvas,process,#ResizeCanvas#,128
Before Change
new_img = Image.new("RGBA", (self.width, self.height), self.color)
if self.anchor:
x = int((self.width - img.size[0]) * Anchor._ANCHOR_PTS[self.anchor][0])
y = int((self.height - img.size[1]) * Anchor._ANCHOR_PTS[self.anchor][1])
else:
x, y = self.x, self.y
new_img.paste(img, (x, y))
After Change
self.color = color or (255, 255, 255, 0)
def process(self, img):
original_width, original_height = img.size
if self.anchor:
anchor = Anchor.get_tuple(self.anchor)
trim_x, trim_y = self.width - original_width, \
self.height - original_height
x = int(float(trim_x) * float(anchor[0]))
y = int(float(trim_y) * float(anchor[1]))
else:
x, y = self.x, self.y
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 7
Instances
Project Name: matthewwithanm/django-imagekit
Commit Name: a164427074b09a19377ac8f94f71c8c5aa269e06
Time: 2012-02-17
Author: matthew@exanimo.com
File Name: imagekit/processors/resize.py
Class Name: ResizeCanvas
Method Name: process
Project Name: Calamari-OCR/calamari
Commit Name: 8d0d0c7a6db3904f0222cbe058388a92cf21a548
Time: 2021-02-06
Author: ChWick@users.noreply.github.com
File Name: calamari_ocr/ocr/dataset/imageprocessors/center_normalizer.py
Class Name: CenterNormalizer
Method Name: normalize
Project Name: baldassarreFe/deep-koalarization
Commit Name: 3a25edce742db97d936ffb645185b520878d0c6d
Time: 2017-05-06
Author: baldassarre.fe@gmail.com
File Name: dataset/resize.py
Class Name: ImagenetResizer
Method Name: resize_img
Project Name: Belval/TextRecognitionDataGenerator
Commit Name: e047bcec68ebf51feaf0dc8f9e9d81b4db87baf2
Time: 2018-10-23
Author: edouard@belval.org
File Name: TextRecognitionDataGenerator/computer_text_generator.py
Class Name: ComputerTextGenerator
Method Name: generate