Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIL.Image.LINEAR no longer exists #13

Closed
Cioffy opened this issue May 9, 2024 · 2 comments
Closed

PIL.Image.LINEAR no longer exists #13

Cioffy opened this issue May 9, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@Cioffy
Copy link

Cioffy commented May 9, 2024

You are using pillow==9.5.0, but despite installing all the libraries required, when executing my code I get:

File /opt/conda/lib/python3.10/site-packages/fdlite/transform.py:66, in image_to_tensor(image, roi, output_size, keep_aspect_ratio, output_range, flip_horizontal)
     63 dst_points = [(0., 0.), (width, 0.), (width, height), (0., height)]
     64 coeffs = _perspective_transform_coeff(src_points, dst_points)
     65 roi_image = img.transform(size=(width, height), method=Image.PERSPECTIVE,
---> 66                           data=coeffs, resample=Image.LINEAR)
     67 # free some memory - we don't need the temporary image anymore
     68 if img != image:

AttributeError: module 'PIL.Image' has no attribute 'LINEAR'

My code is really simple:

from fdlite import FaceDetection, FaceDetectionModel
from fdlite.render import Colors, detections_to_render_data, render_to_image 
from PIL import Image

image = Image.open('ff2fc5a0-22c8-4420-8e0b-1f24ea241fa4.png')
detect_faces = FaceDetection(model_type=FaceDetectionModel.BACK_CAMERA)
faces = detect_faces(image)
if not len(faces):
    print('no faces detected :(')
else:
    render_data = detections_to_render_data(faces, bounds_color=Colors.GREEN)
    render_to_image(render_data, image).show()

I've installed your library thanks to pip, I'm running the code on a VertexAI Jupyter Notebook.
I can't use your library, can you help me?

@patlevin patlevin self-assigned this May 13, 2024
@patlevin
Copy link
Owner

Seems like I would need to update the dependencies to Pillow 10.3.0.

@patlevin patlevin added the enhancement New feature or request label May 13, 2024
@patlevin
Copy link
Owner

@Cioffy The latest version is available via pip and works with pillow 10.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants