FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour oPicture:SaveImage does not work
Posts: 117
Joined: Thu Mar 02, 2006 11:06 AM
oPicture:SaveImage does not work
Posted: 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.
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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: oPicture:SaveImage does not work
Posted: Mon Sep 10, 2007 11:27 AM
Use this modified SaveImage() method:

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
Posts: 117
Joined: Thu Mar 02, 2006 11:06 AM
oPicture:SaveImage does not work
Posted: 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

Posts: 117
Joined: Thu Mar 02, 2006 11:06 AM
oPicture:SaveImage does not work
Posted: Mon Sep 10, 2007 01: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

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
oPicture:SaveImage does not work
Posted: Mon Sep 10, 2007 01:14 PM

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

EMG

Posts: 117
Joined: Thu Mar 02, 2006 11:06 AM
oPicture:SaveImage does not work
Posted: Mon Sep 10, 2007 02:03 PM

Thanks for trying.

Antonio, do you have any idea.

Willy

Continue the discussion