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

Kamil commented on PDFBOX-4176:
-------------------------------

By the way - if I use this workaround, it works fine:

{code}
private BufferedImage workaround(final File file) throws IOException {
    BufferedImage imgIn = ImageIO.read(file);
    if(imgIn.getType() != BufferedImage.TYPE_INT_RGB){
        final BufferedImage newImage = new BufferedImage(imgIn.getWidth(), 
imgIn.getHeight(), BufferedImage.TYPE_INT_RGB);
        newImage.createGraphics().drawImage(imgIn, 0, 0, Color.WHITE, null);
        imgIn = newImage;
    }
    return imgIn;
  }
{code}

> PDImageXObject doesn't support TIFF although JavaDoc says it does
> -----------------------------------------------------------------
>
>                 Key: PDFBOX-4176
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4176
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>            Reporter: Kamil
>            Priority: Major
>         Attachments: tiff.tif
>
>
> This code:
> {code}
> final PDImageXObject jpeg = PDImageXObject.createFromByteArray(doc, 
> IOUtils.toByteArray(new FileInputStream(tiffFile)), "tiff.tif");
> {code}
> throws:
> {code}
> java.lang.IllegalArgumentException: Image type not supported: tiff.tif
>         at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromByteArray(PDImageXObject.java:351)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to