Error create thumbnail in taking picture camera

18 views
Skip to first unread message

ivan limonov

unread,
Jun 30, 2015, 4:38:54 PM6/30/15
to kivy-...@googlegroups.com
Hello.
I need to take a picture and make a thumbnail image that would then have been easier to transmit over the network.
But I have a strange bug when using the MPI:
I/python  ( 5432):    File "/home/wpbloger/mobile/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages/PIL/Image.py", line 1559, in thumbnail
I/python  ( 5432):    File "/home/wpbloger/mobile/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages/PIL/ImageFile.py", line 215, in load
I/python  ( 5432):    File "/home/wpbloger/mobile/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages/PIL/ImageFile.py", line 52, in raise_ioerror
I/python  ( 5432):  IOError: broken data stream when reading image file


Tell me what's wrong, that's a log that the file was successfully created:
D/ConnectivityService(  523): startUsingNetworkFeature took 8ms
W/HTCCamera( 5524): saveAndFinish() - contentUri = 'file:///sdcard/appname/photo.jpg'

How can I fix it?

ivan limonov

unread,
Jun 30, 2015, 8:10:52 PM6/30/15
to kivy-...@googlegroups.com
piece of code responsible for trimming pictures:
output = StringIO.StringIO()
img = Image.open(self.photo)
img.thumbnail((800, 800))
img.save(output, 'JPEG')
data['image'] = base64.b64encode(output.getvalue())


среда, 1 июля 2015 г., 0:38:54 UTC+4 пользователь ivan limonov написал:
Reply all
Reply to author
Forward
0 new messages