Page 1 of 1

xImage formats

Posted: Mon Jan 08, 2018 6:13 pm
by Silvio.Falconi
Wich ext support xImage ?

I saw of docx,xlsx,pptx and emf,wmf,jpg,jpeg,bmp

and on other format ximage can be saved ?

I not seen save method on xImage class

Re: xImage formats

Posted: Mon Jan 08, 2018 6:46 pm
by cnavarro
Silvio.Falconi wrote:
.../...
and on other format ximage can be saved ?

I not seen save method on xImage class


But GDIBmp() Class, yes, have method ::Save()

{ "BMP", "JPG", "GIF", "TIF", "PNG" }

Re: xImage formats

Posted: Mon Jan 08, 2018 8:10 pm
by Silvio.Falconi
Sorry But I not understood

I ' m using XImage object
I have OimagePreview obj where I show the image , how I can save it on other format ?

Re: xImage formats

Posted: Mon Jan 08, 2018 9:13 pm
by cnavarro
Look, but it's possible not save with quality 100% in all formats

Code: Select all | Expand


//----------------------------------------------------------------------------//

Function SaveImg( oImg )

   local oBmp  := GdiBmp():New()
   oBmp:hBmp   := GDIP_FROMHBITMAP( oImg:GetHBitmap(), oImg:aPalBmp[ 1 ], .T. )
   ? oBmp:Save( "ejemplo.png" )
   oBmp:End()

Return nil

//----------------------------------------------------------------------------//


 

Re: xImage formats

Posted: Mon Jan 08, 2018 11:09 pm
by Silvio.Falconi
Cris run ok

Re: xImage formats

Posted: Tue Jan 09, 2018 2:00 am
by nageswaragunupudi
This is running ok for me

Code: Select all | Expand

  hIco  := ICON_EXEREAD( cFile, 4 )
   hBmp  := HBMPFROMHICON( hIco )
   DestroyIcon( hIco )
   oImage:SetSource( hBmp )
   DeleteObject( hBmp )
 


The function HBMPFROMHICON() is available in FWH library and this function also is contributed by Mr mastintin

Re: xImage formats

Posted: Tue Jan 09, 2018 8:56 am
by Silvio.Falconi
Rao thanks now run ok
Image

Re: xImage formats

Posted: Tue Jan 09, 2018 2:23 pm
by cnavarro
Silvio.Falconi wrote:Cris run ok


Silvio, please use and try this function better

Code: Select all | Expand



//----------------------------------------------------------------------------//

Function SaveImg( oImg )

   local oBmp  := GdiBmp():New()
   oBmp:hBmp   := oImg:aPalBmp[ 1 ]
   ? oBmp:Save( "ejemplo0.png" )
   oBmp:End()

Return nil

//----------------------------------------------------------------------------//

 

Re: xImage formats

Posted: Tue Jan 09, 2018 5:00 pm
by Silvio.Falconi
I use this function

Code: Select all | Expand

Function   SalvaImage(oImg)
        Local   nType
       local oBmp  := GdiBmp():New()
       local cFile := cGetFile( "Bitmap (*.bmp)| *.bmp|" +         ;
                             "JPEG  (*.jpg)| *.jpg|" +          ;
                             "GIF   (*.gif)| *.gif|"  +         ;
                             "TIFF (*.tif)| *.tif|" +          ;
                             "PNG   (*.png)| *.png"            ;
                            ,"Salva con il nome",  hb_CurDrive() , .t. )


  * oBmp:hBmp   := GDIP_FROMHBITMAP( oImg:GetHBitmap(), oImg:aPalBmp[ 1 ], .T. )
   oBmp:hBmp   := oImg:aPalBmp[ 1 ]

   IF .NOT. EMPTY( cFile )
             nType := NGETFILEFILTER()
            DO CASE
                  CASE nType == 1
                   cExt := "bmp"
                  CASE nType == 2
                   cExt := "jpg"
                  CASE nType == 3
                   cExt := "gif"
                  CASE nType == 4
                   cExt := "tif"
                  CASE nType == 5
                   cExt := "png"
                ENDCASE
                 cFile := cFilePath( cFile ) + cFileNoExt( cFile ) + "." + cExt
                oBmp:Save(cfile)

                MsgInfo( "saved as: "+ cFile)
   oBmp:End()
  Endif
Return nil
 



I cannot believe xmage cannot save in other Graphics format

Re: xImage formats

Posted: Tue Jan 09, 2018 5:11 pm
by cnavarro
Silvio.Falconi wrote:
I cannot believe xmage cannot save in other Graphics format


This not a problem with XIMAGE, is GDIPLUS
It is possible that GDIPLUS supports other formats, I do not know, and maybe there is someone who can study if it can be saved in other formats.
Out of curiosity, what formats do you need?

Re: xImage formats

Posted: Tue Jan 09, 2018 6:13 pm
by Silvio.Falconi
Now I have a strange problem
Sometimes xmage not read some graphics files . I made a folder with the most format and I have problems to show them

for a sample I have problems to show :

tga
tif
emf
pbm
pcx

while I can show

jpg
jpeg
bmp
gif
png

this can happen if the computer does not open those formats but if I use the paint or infarview I can open them all.
With Image I could open all files with ximage I have limitations

Re: xImage formats

Posted: Tue Jan 09, 2018 6:22 pm
by cnavarro
Silvio.Falconi wrote:Now I have a strange problem
Sometimes xmage not read some graphics files . I made a folder with the most format and I have problems to show them

for a sample I have problems to show :

tga
tif
emf
pbm
pcx

while I can show

jpg
jpeg
bmp
gif
png

this can happen if the computer does not open those formats but if I use the paint or infarview I can open them all.
With Image I could open all files with ximage I have limitations


Ah!, You are talking about showing this type of images with the XIMAGE class?

Re: xImage formats

Posted: Tue Jan 09, 2018 7:15 pm
by nageswaragunupudi
FWH and XImage can display BMP, ICO, GIF, PNG, JPG, JPEG, TIF, TIFF on its own without freeimage.dll. If freeimage.dll exists in the path, it automatically uses fi.dll to display all other image formats too.

Re: xImage formats

Posted: Tue Jan 09, 2018 9:49 pm
by Silvio.Falconi
CONFIRM

If I insert into path of my exe also freeimage.dll and run ok

I can show

pcx
tga

but I not show

pbm

I must control if freeimage open pbm files