Migrating Python 2 to 3: images

35 views
Skip to first unread message

Joshua Smith

unread,
Feb 24, 2020, 3:18:38 PM2/24/20
to Google App Engine
I need to read and resize an image in my google app engine app. In my python2.7 code, this is simply:

from google.appengine.api import images
image = images.resize(image, width=1024, output_encoding=images.JPEG, correct_orientation=images.CORRECT_ORIENTATION)

I can’t find anything the migration guide that suggests an alternative to this API (but several places say I need to find one). So helpful.

What does this august body recommend I use to replace the above two lines of code? I certainly don’t want to have to use some web-based micro-service for such a simple thing.

-Joshua

Andrew Gorcester

unread,
Feb 24, 2020, 6:05:45 PM2/24/20
to google-a...@googlegroups.com
The migration guide does have a brief section in the overview: https://cloud.google.com/appengine/docs/standard/python/migrate-to-python3/migrating-services which suggests migrating to third-party image services. However, depending on your use case (keeping in mind impacts on security and performance) you may find it more suitable to install a library which performs the operation in-place on your App Engine instance. Pillow is one I have used in the past.

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/DA44AE42-4D42-47C1-BE0B-9726516FF865%40gmail.com.
Reply all
Reply to author
Forward
0 new messages