[ 
https://issues.apache.org/jira/browse/IMAGING-141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14266638#comment-14266638
 ] 

Josh Highley commented on IMAGING-141:
--------------------------------------

To get a sample image, just use any image editor (GIMP, possibly MS Paint) to 
save a black-and-white image as G3 or G4 TIFF.

No reason to speculate on why setRGB is so slow: source code is available.  
Yes, it's _much_ faster to set pixels en masse using int[] instead of one at a 
time.

The fact that you ask if 1 byte per pixel is okay concerns me.  It's sloppy and 
not correct.  This isn't about whatever is acceptable to me.  The BPP is in the 
TIFF tag.  If it's 8, set BufferedImage type to TYPE_BYTE_GRAY.  If it's 1, set 
type to TYPE_BYTE_BINARY.  

> BufferedImage from TIFF is always 24 or 32 bpp
> ----------------------------------------------
>
>                 Key: IMAGING-141
>                 URL: https://issues.apache.org/jira/browse/IMAGING-141
>             Project: Commons Imaging
>          Issue Type: Bug
>          Components: Format: TIFF
>            Reporter: Josh Highley
>             Fix For: Patch Needed
>
>
> When getting a BufferedImage from a TIFF, TiffImageParser.getBufferedImage 
> gets the TIFF's BPP from the TIFF tags, but at the end 
> ImageBuilder.getBufferedImage() will always set the BufferedImage ColorModel 
> BPP to 32 for images with alpha and 24 bpp otherwise.  Many TIFFs are 1 bpp 
> (G3 and G4) so the BufferedImage should also be 1 bpp.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to