View Single Post
Old 09-18-2015, 10:05 AM   #49
CalibUser
Addict
CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.
 
Posts: 203
Karma: 62362
Join Date: Jul 2015
Device: Sony
I have updated the plugin in the first post so that images in an ePub can be resized.

This will require the PILlow image library from https://pypi.python.org/pypi/Pillow/2.9.0

I decided to make the plugin 'beep' if an alphabetical character is inserted in an entry box for image size; as there is not a 'beep' facility within Python I had to produce a 'beep' that is system dependent. I have only been able to test this on Windows 7, hopefully this will work on Linux (I believe it will be necessary to install sox for the 'beep') and Mac systems too.

One problem I had with the code for resizing the image was that I could not seem to read the image file using bk.readfile() into a buffer that PILow could process [I experimented with frombytes(), frombuffer() and fromarray()] so I resorted to saving the original image to disc and opening it again under PILow - not an ideal process.

The ePub manual in the first post contains instructions on how to use the new feature.
CalibUser is offline   Reply With Quote