Alaska Software Inc. - Transform a Tiff image to JPG (or PNG)
Username: Password:
AuthorTopic: Transform a Tiff image to JPG (or PNG)
Jose Adriano BaltieriTransform a Tiff image to JPG (or PNG)
on Wed, 06 Sep 2017 17:04:52 -0300
Hello !

I have a bunch of image files in Tiff format.

Am I able to transform them directly into JPG or PNG using XBase++ only ?

Of course I can find out some external product and do it via RunShell 
but I'd like to something embeded in XBase++ itself.

Thanks in advance !
Andreas Gehrs-Pahl
Re: Transform a Tiff image to JPG (or PNG)
on Wed, 06 Sep 2017 18:35:38 -0400
Jose,

>Am I able to transform them directly into JPG or PNG using XBase++ only?

Only if you write your own routines to read (and parse) TIFF files, as 
Xbase++ doesn't know anything about that format. As the TIFF specifications 
are quite complex, your best bet is probably to use an external converter 
utility.

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[F]:   https://www.facebook.com/AbsoluteSoftwareLLC
Thomas BraunRe: Transform a Tiff image to JPG (or PNG)
on Thu, 07 Sep 2017 08:59:12 +0200
Andreas Gehrs-Pahl wrote:

> Jose,
> 
>>Am I able to transform them directly into JPG or PNG using XBase++ only?
> 
> Only if you write your own routines to read (and parse) TIFF files, as 
> Xbase++ doesn't know anything about that format. As the TIFF specifications 
> are quite complex, your best bet is probably to use an external converter 
> utility.

In that case, https://www.imagemagick.org/script/index.php would be my
favourite tool, open source, maintained actively...

thomas
Jim LeeRe: Transform a Tiff image to JPG (or PNG)
on Fri, 08 Sep 2017 03:08:17 +0200
> Am I able to transform them directly into JPG or PNG using XBase++ only ?

as 3-PP Lib you can use FreeImage http://freeimage.sourceforge.net/

at Pablos Website www.xbwin.com you will find a Wrapper using Xbase++ OOP 
Syntax with ot4xb
Jose Antonio Diego KerejeRe: Transform a Tiff image to JPG (or PNG)
on Fri, 08 Sep 2017 09:36:25 +0200
Hi Jose,

I use this code and the Windows Image Acquisition (WIA) interface.

Regards. Diego


Test.zip
Peter AlderliestenRe: Transform a Tiff image to JPG (or PNG)
on Tue, 12 Sep 2017 09:57:57 +0200
Diego,

> I use this code and the Windows Image Acquisition (WIA) interface.

What's the reason you selected this solution? Just to be able to handle
more formats than are currently supported with Xbase++?

Peter
Jose Antonio Diego KerejeRe: Transform a Tiff image to JPG (or PNG)
on Thu, 14 Sep 2017 11:15:59 +0200
Peter,

> What's the reason you selected this solution?
> Just to be able to handle more formats than
> are currently supported with Xbase++?

Years ago I was "researching" the WIA option for the control of a document 
scanning solution.
I also needed a "basic" manipulation of images (resize, rotate, stamp ...) 
and the ability to generate pngs, since the XbpBitmap class did not do the 
job correctly at that time. And finally, one of my first goals was not to 
use third-party software.

That's why I used the WIA option, especially since there are many examples 
on the WWW, that are easy to implement in Xbase ++

Ex:


********************************************
FUNCTION Rotate( cFile, cNewFile, nDegrees )
********************************************
LOCAL lSuccess:= .T.
LOCAL bError  := ErrorBlock( {|e| Break( e ) } )
LOCAL oImg, oIP, oFilters, oPT1, oFilter

BEGIN SEQUENCE
   oImg    := CreateObject( 'WIA.ImageFile'    )
   oIP     := CreateObject( 'WIA.ImageProcess' )
   oFilters:= oIP:Filters

   oImg:loadFile( cFile )

   oPT1:= oIP:filterInfos( 'RotateFlip' )
      oFilters:add( oPT1:filterID )
      oPT1:destroy()
      oFilters:destroy()

   oFilter:= oIP:filters( 1 )
      oPT1:= oFilter:properties( 'RotationAngle' ) ; oPT1:Value := nDegrees 
; oPT1:destroy()
      oFilter:destroy()

   oPT1:= oIP:Apply( oImg ) ; oPT1:SaveFile( cNewFile ) ; oPT1:destroy()

   oImg:destroy()
   oIP:destroy()
RECOVER
   lSuccess:= .F.
   FErase( cNewFile )

   IF oImg     # nil ; BEGIN SEQUENCE ; oImg:destroy()     ; END SEQUENCE ; 
ENDIF
   IF oIP      # nil ; BEGIN SEQUENCE ; oIP:destroy()      ; END SEQUENCE ; 
ENDIF
   IF oFilters # nil ; BEGIN SEQUENCE ; oFilters:destroy() ; END SEQUENCE ; 
ENDIF
   IF oPT1     # nil ; BEGIN SEQUENCE ; oPT1:destroy()     ; END SEQUENCE ; 
ENDIF
   IF oFilter  # nil ; BEGIN SEQUENCE ; oFilter:destroy()  ; END SEQUENCE ; 
ENDIF
END SEQUENCE
ErrorBlock( bError )
RETURN lSuccess


Regards. Diego
Edgar Borger Re: Transform a Tiff image to JPG (or PNG)
on Mon, 11 Sep 2017 10:17:21 -0300
hi Jose,

you can do it with FreeImage, easy.

something like this:

procedure main

dll := DllLoad( "FreeImage.Dll" )
arq := Directory("*.JPG")
for i = 1 to len(arq)
	fl := arq[i,1]

	img := DllCall( dll, 8, "_FreeImage_Load@12", 2, fl, 0 )
	cnv := DllCall( dll, 8, "_FreeImage_ConvertTo24Bits@4", img )
	ok  := DllCall( dll, 8, "_FreeImage_Save@16", 2, cnv, fl, 0 )

next

return


Em 06/09/2017 17:04, Jose Adriano Baltieri escreveu:
> Hello !
> 
> I have a bunch of image files in Tiff format.
> 
> Am I able to transform them directly into JPG or PNG using XBase++ only ?
> 
> Of course I can find out some external product and do it via RunShell but I'd like to something embeded in XBase++ itself.
> 
> Thanks in advance !


Edgar Borger
Softsupply Informatica Ltda.
Rua Alagoas, 48
Sao Paulo, SP
01242-000
Tel   : (5511) 3159-1997
Email : softsupply@terra.com.br