Looking at the code in replaceHeader, I see that it overwrites the image's width, height, number of components, and sampling factors with its own hardcoded values. Won’t that just break most JPEG files?
I’d like to remove this code because it doesn’t really seem like an appropriate solution to the problem and we don’t have any test PDFs. If somebody encounters this issue again out in the real world we’ll at least get a test PDF when they open a new issue. I’m incredibly doubtful that this code is being executed at all out in the wild (excluding the one file it was written for). It’s making it difficult for me to refactor PDJpeg. -- John On 3 Feb 2014, at 01:34, Timo Boehme <[email protected]> wrote: > Hi, > > Am 01.02.2014 22:39, schrieb John Hewson: >> Hi All >> >> Does anyone have a PDF file which triggers the call to >> PDJpeg#replaceHeader? The comment in the code claims that it fixes >> JPEGs with malformed “Adobe” headers, but I can’t find anything on >> Google about such images. Is this a real issue or a historic ImageIO >> bug? > > While I do not have such an PDF I've found a discussion about this topic at > stackoverflow: > http://stackoverflow.com/questions/7676701/java-jpeg-converter-for-odd-image-types > > I don't known if ImageIO was changed to work with strange/malformed JPEG > headers. But I don't think so. > Maybe replacing/'fixing' the header should at least trigger a warning message > since it won't be clear if the resulting image is ok, thus one gets a hint > what the reason for a wrong image could have been. > > > Best, > Timo > > > -- > > Timo Boehme > OntoChem GmbH > H.-Damerow-Str. 4 > 06120 Halle/Saale > T: +49 345 4780474 > F: +49 345 4780471 > [email protected] > > _____________________________________________________________________ > > OntoChem GmbH > Geschäftsführer: Dr. Lutz Weber > Sitz: Halle / Saale > Registergericht: Stendal > Registernummer: HRB 215461 > _____________________________________________________________________ >
