You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Thad Humphries <th...@gmail.com> on 2017/02/18 16:15:51 UTC

Question about CCITTFactory

I am processing images, mostly TIFF Group 4, from a repository, and
outputting them as PDF. The images *always* come to me in a byte array,
never as a file. In fact, I've no option to get it as a file. The
repository may or may not be local--it's accessed through its own API.

I would like to convert this buffer directly to a PDImageXObject, but both
the CCITTFactory.createFromRandomAccess() are deprecated. Why? Looking at
the source for the CCITTFactory class, they do the same thing as the
createFromFile() methods, which first create a RandomAccessFile before
calling createFromRandomAccessImpl().

Outside of this project, I've tried CCITTFactory.createFromFile() and seen
that it is significantly faster than creating a BufferedImage and calling
CCITTFactory.createFromImage(). Possibly it's fast enough to take the hit
of writing the TIFF byte array to a temporary file, but why take the hit?

So, why are CCITTFactory.createFromRandomAccess() are deprecated?

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 121-24)

Re: Question about CCITTFactory

Posted by Thad Humphries <th...@gmail.com>.
On Sun, Feb 19, 2017 at 4:20 AM, Tilman Hausherr <TH...@t-online.de>
wrote:

> Am 18.02.2017 um 17:15 schrieb Thad Humphries:
>
>> I am processing images, mostly TIFF Group 4, from a repository, and
>> outputting them as PDF. The images *always* come to me in a byte array,
>> never as a file. In fact, I've no option to get it as a file. The
>> repository may or may not be local--it's accessed through its own API.
>>
>> I would like to convert this buffer directly to a PDImageXObject, but both
>> the CCITTFactory.createFromRandomAccess() are deprecated. Why? Looking at
>> the source for the CCITTFactory class, they do the same thing as the
>> createFromFile() methods, which first create a RandomAccessFile before
>> calling createFromRandomAccessImpl().
>>
>> Outside of this project, I've tried CCITTFactory.createFromFile() and seen
>> that it is significantly faster than creating a BufferedImage and calling
>> CCITTFactory.createFromImage(). Possibly it's fast enough to take the hit
>> of writing the TIFF byte array to a temporary file, but why take the hit?
>>
>> So, why are CCITTFactory.createFromRandomAccess() are deprecated?
>>
>>
> That was done in the last commit of
>
> https://issues.apache.org/jira/browse/PDFBOX-2589
>
> There was no discussion, probably nobody bothered about it. I assume it
> looked cleaner than this weird RandomAccess thing.
>
> I'd agree that "The images *always* come to me in a byte array" is a good
> argument to un-deprecate the two methods.
>
> Please create a new issue in JIRA and copy your argument there. I'll
> undeprecate the methods but will do this after some wait to give John time
> to state his opinion.
>
> Tilman
>

Done: https://issues.apache.org/jira/browse/PDFBOX-3696

Thank you.

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v. 121-24)

Re: Question about CCITTFactory

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 18.02.2017 um 17:15 schrieb Thad Humphries:
> I am processing images, mostly TIFF Group 4, from a repository, and
> outputting them as PDF. The images *always* come to me in a byte array,
> never as a file. In fact, I've no option to get it as a file. The
> repository may or may not be local--it's accessed through its own API.
>
> I would like to convert this buffer directly to a PDImageXObject, but both
> the CCITTFactory.createFromRandomAccess() are deprecated. Why? Looking at
> the source for the CCITTFactory class, they do the same thing as the
> createFromFile() methods, which first create a RandomAccessFile before
> calling createFromRandomAccessImpl().
>
> Outside of this project, I've tried CCITTFactory.createFromFile() and seen
> that it is significantly faster than creating a BufferedImage and calling
> CCITTFactory.createFromImage(). Possibly it's fast enough to take the hit
> of writing the TIFF byte array to a temporary file, but why take the hit?
>
> So, why are CCITTFactory.createFromRandomAccess() are deprecated?
>

That was done in the last commit of

https://issues.apache.org/jira/browse/PDFBOX-2589

There was no discussion, probably nobody bothered about it. I assume it 
looked cleaner than this weird RandomAccess thing.

I'd agree that "The images *always* come to me in a byte array" is a 
good argument to un-deprecate the two methods.

Please create a new issue in JIRA and copy your argument there. I'll 
undeprecate the methods but will do this after some wait to give John 
time to state his opinion.

Tilman



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