You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2019/03/14 19:33:00 UTC

[jira] [Commented] (PDFBOX-4486) "premature EOF, image will be incomplete" when using subsampling

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

Tilman Hausherr commented on PDFBOX-4486:
-----------------------------------------

From the javadoc of IIOParam.setSourceSubsampling()
{quote}The number of subsampled pixels in a scanline is given by
{code:java}
truncate[(width - subsamplingXOffset + sourceXSubsampling - 1)/ sourceXSubsampling]. 
{code}
{quote}
Our code in SampledImageReader is
{code:java}
final int width = (int) Math.ceil(clipped.getWidth() / subsampling);
final int height = (int) Math.ceil(clipped.getHeight() / subsampling);
{code}
I could change this, but I had a look at the jbig2 code and found this in Bitmaps.java:
{code:java}
final int dstWidth = (src.getWidth() - xSubsamplingOffset) / xSubsampling;
final int dstHeight = (src.getHeight() - ySubsamplingOffset) / ySubsampling;
{code}
(and similar at two other places).

Because of that we sometimes calculate a different size (one row more) than the one returned by the jbig2 decoder. This happens when doing PDFToImage -subsampling -dpi 96 .

I'd like to hear the opinion of [~itai] and [~hennejg]. I'm not yet sure whether I should change both.

> "premature EOF, image will be incomplete" when using subsampling
> ----------------------------------------------------------------
>
>                 Key: PDFBOX-4486
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4486
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.14, 3.0.0 PDFBox
>            Reporter: Tilman Hausherr
>            Priority: Major
>
> Follow-up to PDFBOX-4484. The image from there brings the error message "premature EOF, image will be incomplete" and a black pixel line when rendering at 76..100 dpi with PDFToImage using the subsampling option.



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

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