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 2014/03/11 23:07:43 UTC

[jira] [Comment Edited] (PDFBOX-1975) Improve TestImageIOUtils unit tests to check image resolution and compression

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

Tilman Hausherr edited comment on PDFBOX-1975 at 3/11/14 10:06 PM:
-------------------------------------------------------------------

0)
I will do this in several steps over several days, to be able to fix things quickly if anything breaks.

1)
John, I had to revert most of your changes in setDPI(). Your changes prevented the creation of BMP files (if JAI is present). However I did some refactoring too, which might further confuse things :-)

(nobody cares about BMP files, but they were created before the change).

The probable reason for the failure to create a BMP file is that you inserted "just the data" as new, while the old code tried to "blend into the existing data". Feel free to refactor again later after I've inserted the unit tests. In theory, your (smaller) solution would have been correct because "mergeTree" should have blended the new data into the existing one, but it just didn't work for BMP.

I committed these changes in rev 1576520.

2)
The filename in ImageIOUtil.writeImage() is used as a prefix, i.e. the method attaches the type suffix. This is probably from the old PDFWriter class. So either the documentation should be altered to mention this, or the code should be changed that the suffix is not appended.


was (Author: tilman):
0)
I will do this in several steps over several days, to be able to fix things quickly if anything breaks.

1)
John, I had to revert most of your changes in setDPI(). Your changes prevented the creation of BMP files (if JAI is present). However I did some refactoring too, which might further confuse things :-)

(nobody cares about BMP files, but they were created before the change).

The probable reason for the failure to create a BMP file is that you inserted "just the data" as new, while the old code tried to "blend into the existing data". Feel free to refactor again later after I've inserted the unit tests. In theory, your (smaller) solution would have been correct because "mergeTree" should have blended the new data into the existing one, but it just didn't work for BMP.

I committed these changes in rev XXXX.

2)
The filename in ImageIOUtil.writeImage() is used as a prefix, i.e. the method attaches the type suffix. This is probably from the old PDFWriter class. So either the documentation should be altered to mention this, or the code should be changed that the suffix is not appended.

> Improve TestImageIOUtils unit tests to check image resolution and compression
> -----------------------------------------------------------------------------
>
>                 Key: PDFBOX-1975
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1975
>             Project: PDFBox
>          Issue Type: Task
>          Components: Utilities
>    Affects Versions: 2.0.0
>            Reporter: Tilman Hausherr
>            Assignee: Tilman Hausherr
>            Priority: Minor
>              Labels: imageio, test, tiff
>             Fix For: 2.0.0
>
>
> Because of the problems with recent changes (see PDFBOX-1963), I will improve the unit tests so that image resolution and compression is checked.
> I found out that JPEGs don't have a resolution, BMP had the wrong resolution. The fault wasn't in the java TIFF writer as I thought before, it is in the java PNG writer, which uses the PixelSize values wrongly, i.e. it interprets them as "pixels per mm" instead of "mm per pixel" as per specification. The JPEG writer throws an exception "JFIF APP0 must be first marker after SOI". The BMP writer can set the resolution, but the BMP reader doesn't read it.
> (Some of this might be different depending on the version)



--
This message was sent by Atlassian JIRA
(v6.2#6252)