On Monday, 30 March 2015 16:48:08 UTC-7, Chris Angelico  wrote:
> On Tue, Mar 31, 2015 at 8:22 AM,  <duderino> wrote:
> > rotimg = img.rotate(270) # rotation is counterclockwise
> 
> Unless the 90 and 270 cases are documented as being handled specially,
> I'd look for a dedicated function for doing those changes. A quick
> perusal of the docs showed up this:
> 
> http://pillow.readthedocs.org/en/latest/reference/Image.html#PIL.Image.Image.transpose
> 
> Is that any better, or is that doing the exact same thing as rotate()?
> 
> By the way:
> 
> > The black & white only device (1024 (X) x 1280 (Y)) expects the compressed 
> > data based on portrait mode, i.e. 8 pixels combined into one bytes for 1280 
> > rows of 128 bytes.
> >
> 
> This sounds to me like the fax standard. I wonder, can you make use of
> a TIFF library to do some of your work for you?
> 
> ChrisA

According to the docs rotate & transform can both be used and should do the 
same in my case - but they are not.

rotimg = img.transpose(Image.ROTATE_270) 
print img.getbbox()
print rotimg.getbbox()

gives

(0, 0, 1280, 1024)
(0, 0, 1024, 1280)

while

rotimg = img.rotate(270, 0, 1)
print img.getbbox()
print rotimg.getbbox()

gives

(0, 0, 1280, 1024)
(1, 1, 1025, 1281)

Neither one produces good output when the compression is applied. 

Don't think it's related to fax standards - it's proprietary (E-Ink Tile)
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to