Issue 21 in pylibtiff: RGB image format doesn't follow the standard numpy RGB format

12 views
Skip to first unread message

pyli...@googlecode.com

unread,
Oct 9, 2012, 5:03:15 AM10/9/12
to pylibtif...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 21 by eric.p...@gmail.com: RGB image format doesn't follow the
standard numpy RGB format
http://code.google.com/p/pylibtiff/issues/detail?id=21

write_image() supports RGB image if write_rgb=True is passed, but it
expects an numpy array in the format 3xMxN for an image of MxN pixels,
while the normal RGB images in numpy are encoded MxNx3.

For reference, see the documentation here:
http://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.imread.html

As a workaround, I currently send a view of my array with axes swapped to
write_image. Like this:
image = scipy.ndimage.imread("test.jpg")
image_sw = image.swapaxes(2,0).swapaxes(2,1)
tif.write_image(image_sw, write_rgb=True)


I can try to provide a patch if you're interested.

pyli...@googlecode.com

unread,
Aug 5, 2013, 10:09:03 AM8/5/13
to pylibtif...@googlegroups.com

Comment #1 on issue 21 by eric.p...@gmail.com: RGB image format doesn't
follow the standard numpy RGB format
http://code.google.com/p/pylibtiff/issues/detail?id=21

Please find here a patch (against the current svn HEAD) to fix this issue.
It enhances the behaviour of TIFF.write_image() when write_rgb=True.

Basically, when this flag is True, write_image() will always write a single
image, and try its best to describe it as a RGB (or RGBA) image.

Note that it also modifies the orientation tag to the correct value, which
fixes issue 18.

The patch is available also as a git commit here:
https://github.com/delmic/pylibtiff/commit/cc38e51ae0857b605c81e7f631279b5cd54de55d

Attachments:
0002-improve-support-for-RGB-writing.patch 5.7 KB

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

pyli...@googlecode.com

unread,
Sep 13, 2014, 6:12:03 PM9/13/14
to pylibtif...@googlegroups.com
Updates:
Status: Fixed

Comment #2 on issue 21 by pearu.peterson: RGB image format doesn't follow
the standard numpy RGB format
https://code.google.com/p/pylibtiff/issues/detail?id=21

Thanks! Patch applied to svn.
Reply all
Reply to author
Forward
0 new messages