oPicture:SaveImage does not work

oPicture:SaveImage does not work

Postby Willy » Mon Sep 10, 2007 10:50 am

Here is a sample of the code I used.

It generated only an empty file of 0 bytes.

Someone an idea of what I am doing wrong.
Code: Select all  Expand view  RUN
Static Function LoadJpg(oPicture,cId)
cId := Trim(cId) + ".JPG"
oPicture:LoadFromClipboard()

oPicture:Refresh()

Return Nil

Static Function SaveJpg(oPicture,cId)
cId := Trim(cId)

oPicture:SaveImage(cId,2,25)
Return Nil


Thanks
Willy
Willy
 
Posts: 117
Joined: Thu Mar 02, 2006 11:06 am
Location: Belgium

Re: oPicture:SaveImage does not work

Postby Enrico Maria Giordano » Mon Sep 10, 2007 11:27 am

Use this modified SaveImage() method:

Code: Select all  Expand view  RUN
METHOD SaveImage( cFile, nFormat, nQuality ) CLASS TImage

   //   0 -> Bmp
   //   2 -> Jpg
   //  13 -> Png

   local hDib := DibFromBitmap( ::hBitmap )
   local cTempFile := cTempFile()
   local lSaved

   DibWrite( cTempFile, hDib )

   GloBalFree( hDib )

   lSaved = FISaveImg( cTempFile, cFile, nFormat, nQuality )

   FErase( cTempFile )

return lSaved


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Willy » Mon Sep 10, 2007 11:41 am

Hello,

I was aleady using this version of this method.

However I have copied it. The result is the same. There is a JPG file created from 0 bytes.

I use the freeimage.dll from 4SEP2005 19h01 from 1032 Kb.

This is the one that is delivered with the latest FWH

Thanks,

Willy
Willy
 
Posts: 117
Joined: Thu Mar 02, 2006 11:06 am
Location: Belgium

Postby Willy » Mon Sep 10, 2007 1:05 pm

I think I found an error in the tImage class.

In the header the method SaveImage does not mention the nQuality parameter.

The method however has the third parameter.

However this does not change the result.

I've tried the program also on a Vista PC. There is a difference. On that pc there is no file added.

On a Xp PC there is a file created with 0 bytes

Bey

Willy
Willy
 
Posts: 117
Joined: Thu Mar 02, 2006 11:06 am
Location: Belgium

Postby Enrico Maria Giordano » Mon Sep 10, 2007 1:14 pm

Sorry, it is working fine here. I don't know why it does't work for you.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Willy » Mon Sep 10, 2007 2:03 pm

Thanks for trying.

Antonio, do you have any idea.

Willy
Willy
 
Posts: 117
Joined: Thu Mar 02, 2006 11:06 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 58 guests