From: Shotgun Thom on
On Mar 4, 1:57 pm, Tony Girgenti <tony(nospam)@lakesideos.com> wrote:

> After doing more reading and testing, i realized that our tif files are all
> multipage files.  That is an issue i will have to work on.

You do understand that JPEG is not a multipage image format, correct?
If you convert a 10 page multipage TIFF to JPEG you will get 10
separate JPEG images. There are only a few multipage image formats
out there such as TIFF, rasterized PDF, or GIF. I have seen instances
where, once the jpegs were created, they were stitched together into
one huge jpeg.

May I ask your purpose of converting from Tiff to Jpeg? There may be
a better alternative.

Tom

From: Tony Girgenti on
Karl and Shotgun,

I have a third party forms processor that creates output forms tailored by
the user and it has the ability to accept image files to insert into the
forms. The only problem is that this forms processor will allow any type of
image *except* '.TIF' images. So, I'm trying to find a way to convert our
..TIF images to .JPG or any other type before I send it to the forms
processor. I'm trying to do it dynamically on an as needed basis in my VB 6
program.

I do understand that a four page tif image will have to output four jpg
files. That is not a problem because i can send as many jpg(or any other
type) files to the forms processor. I just can't send a .TIF file. I think
the forms processor will also accept PDF.

I am working on Karl's suggestion to use 'FreeImage_OpenMultiBitmap' and i
actually have it working except, the four jpg files that it creates, are
still empty. I used the 'FreeImage_InitErrorHandler' to capture any errors
and it gives this error four times:

[FreeImage] Error: only 24-bit highcolor or 8-bit greyscale/palette bitmaps
can be saved as JPEG
Image: JPEG
Code: 2

I am currently working on trying to figure how to tell FreeImage to use the
last parameter in this statement:

jpgOutputPageLong = FreeImage_Save(FIF_JPEG, dib, "c:\test" &
pageCountInteger + 1 & ".jpg", JPEG_DEFAULT)

I think that's where i need to fix the error i am getting.

Thanks,
Tony

"Shotgun Thom" wrote:

> On Mar 4, 1:57 pm, Tony Girgenti <tony(nospam)@lakesideos.com> wrote:
>
> > After doing more reading and testing, i realized that our tif files are all
> > multipage files. That is an issue i will have to work on.
>
> You do understand that JPEG is not a multipage image format, correct?
> If you convert a 10 page multipage TIFF to JPEG you will get 10
> separate JPEG images. There are only a few multipage image formats
> out there such as TIFF, rasterized PDF, or GIF. I have seen instances
> where, once the jpegs were created, they were stitched together into
> one huge jpeg.
>
> May I ask your purpose of converting from Tiff to Jpeg? There may be
> a better alternative.
>
> Tom
>
> .
>
From: Karl E. Peterson on
Tony Girgenti wrote:
> Karl and Shotgun,
>
> I have a third party forms processor that creates output forms tailored by
> the user and it has the ability to accept image files to insert into the
> forms. The only problem is that this forms processor will allow any type of
> image *except* '.TIF' images. So, I'm trying to find a way to convert our
> .TIF images to .JPG or any other type before I send it to the forms
> processor. I'm trying to do it dynamically on an as needed basis in my VB 6
> program.
>
> I do understand that a four page tif image will have to output four jpg
> files. That is not a problem because i can send as many jpg(or any other
> type) files to the forms processor. I just can't send a .TIF file. I think
> the forms processor will also accept PDF.
>
> I am working on Karl's suggestion to use 'FreeImage_OpenMultiBitmap' and i
> actually have it working except, the four jpg files that it creates, are
> still empty. I used the 'FreeImage_InitErrorHandler' to capture any errors
> and it gives this error four times:
>
> [FreeImage] Error: only 24-bit highcolor or 8-bit greyscale/palette bitmaps
> can be saved as JPEG
> Image: JPEG
> Code: 2
>
> I am currently working on trying to figure how to tell FreeImage to use the
> last parameter in this statement:
>
> jpgOutputPageLong = FreeImage_Save(FIF_JPEG, dib, "c:\test" &
> pageCountInteger + 1 & ".jpg", JPEG_DEFAULT)
>
> I think that's where i need to fix the error i am getting.

What are you passing in the second parameter (dib)? (I think that
oughta be the return value from FI_LockPage.)

--
..NET: It's About Trust!
http://vfred.mvps.org


From: Tony Girgenti on
Hello Karl.

Here is my whole procedure. I tried changing the 'dib' and still get the
same error.

Thanks for any help that you can provide.

Tony

Private Sub btnTest_Click()

Dim dib As Long
Dim bOK As Long
Dim pageCountOfImage As Long
Dim pageOfImage As Long
Dim pageCountInteger As Integer
Dim jpgOutputPageLong As Long
Dim tifInputPageLong As Long
Dim tifInputImageTypeFIT As FREE_IMAGE_TYPE
Dim tifInputImageWidth As Long

FreeImage_InitErrorHandler
dib = FreeImage_OpenMultiBitmap(FIF_TIFF, C:\test.tif", 0, 1, 1, 0)
tifInputImageTypeFIT = FreeImage_GetImageType(dib)
tifInputImageWidth = FreeImage_GetWidth(dib)
pageCountOfImage = FreeImage_GetPageCount(dib)

For pageCountInteger = 0 To pageCountOfImage - 1

tifInputPageLong = FreeImage_LockPage(dib, pageCountInteger)
jpgOutputPageLong = FreeImage_Save(FIF_JPEG, dib, "c:\test" &
pageCountInteger + 1 & ".jpg", JPEG_DEFAULT)
Call FreeImage_UnlockPage(dib, tifInputPageLong, 0)

Next pageCountInteger

bOK = FreeImage_CloseMultiBitmap(dib, 0)
FreeImage_Unload (dib)

End Sub


"Karl E. Peterson" wrote:

> Tony Girgenti wrote:
> > Karl and Shotgun,
> >
> > I have a third party forms processor that creates output forms tailored by
> > the user and it has the ability to accept image files to insert into the
> > forms. The only problem is that this forms processor will allow any type of
> > image *except* '.TIF' images. So, I'm trying to find a way to convert our
> > .TIF images to .JPG or any other type before I send it to the forms
> > processor. I'm trying to do it dynamically on an as needed basis in my VB 6
> > program.
> >
> > I do understand that a four page tif image will have to output four jpg
> > files. That is not a problem because i can send as many jpg(or any other
> > type) files to the forms processor. I just can't send a .TIF file. I think
> > the forms processor will also accept PDF.
> >
> > I am working on Karl's suggestion to use 'FreeImage_OpenMultiBitmap' and i
> > actually have it working except, the four jpg files that it creates, are
> > still empty. I used the 'FreeImage_InitErrorHandler' to capture any errors
> > and it gives this error four times:
> >
> > [FreeImage] Error: only 24-bit highcolor or 8-bit greyscale/palette bitmaps
> > can be saved as JPEG
> > Image: JPEG
> > Code: 2
> >
> > I am currently working on trying to figure how to tell FreeImage to use the
> > last parameter in this statement:
> >
> > jpgOutputPageLong = FreeImage_Save(FIF_JPEG, dib, "c:\test" &
> > pageCountInteger + 1 & ".jpg", JPEG_DEFAULT)
> >
> > I think that's where i need to fix the error i am getting.
>
> What are you passing in the second parameter (dib)? (I think that
> oughta be the return value from FI_LockPage.)
>
> --
> ..NET: It's About Trust!
> http://vfred.mvps.org
>
>
> .
>
From: Shotgun Thom on
On Mar 4, 3:37 pm, Tony Girgenti <tony(nospam)@lakesideos.com> wrote:
> Karl and Shotgun,

> [FreeImage] Error: only 24-bit highcolor or 8-bit greyscale/palette bitmaps
> can be saved as JPEG
>             Image: JPEG
>             Code:  2
>
> I am currently working on trying to figure how to tell FreeImage to use the
> last parameter in this statement:
>
> jpgOutputPageLong = FreeImage_Save(FIF_JPEG, dib, "c:\test" &
> pageCountInteger + 1 & ".jpg", JPEG_DEFAULT)

I've not used FreeImage so I can't specifically tell you the process
to use with this package. However, the error message you wrote
indicates that you may be trying to convert a 1bit (ccitt4
compression) TIFF. The TIFF format has several different types of
compression. The two most often seen are LZW and CCITT4. The CCITT4
is basically a 1bit B&W format most often used for archiving (because
the file size is small) or faxing. The error message is telling you
that the minimum color depth for JPEG's is 8bit (256 color or
greyscale).

Do know the compression format of the TIFF's you're using?

Tom