Error 10 in gflsavebitmap (VB)

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, helmut, xnview

rmgarcia

Error 10 in gflsavebitmap (VB)

Post by rmgarcia »

I use a GFL SDK v2.11 and I want to copy an image from clipboard and after save in a jpg file, but I get a 10 error, I don't understand, why?.

The visual basic code

Code: Select all

    Error = gflImportFromClipboard(ptrimagen)
        extGetGflBitmapFromPtr ptrimagen, imagen

        MsgBox CStr(imagen.Width)

        Error = gflChangeColorDepth(imagen, ptri, GFL_MODE_TO_RGB, GFL_MODE_NO_DITHER)

        extGetGflBitmapFromPtr ptri, ima

        parametros.FormatIndex = gflGetFormatIndexByName("jpeg")
        parametros.Quality = 100
        parametros.Progressive = False
        parametros.OptimizeHuffmanTable = False
        parametros.ChannelOrder = GFL_CTYPE_RGB

        Error = gflSaveBitmap("c:\qw.jpg", ima, parametros)
       MsgBox CStr(Error) ' Here show me 10
thanks for your help.
User avatar
xnview
Author of XnView
Posts: 43897
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: error 10 in gflsavebitmap

Post by xnview »

rmgarcia wrote:I use a GFL SDK v2.11 and I want to copy an image from clipboard and after save in a jpg file, but I get a 10 error, I don't understand, why?.

The visual basic code

Error = gflImportFromClipboard(ptrimagen)
extGetGflBitmapFromPtr ptrimagen, imagen

MsgBox CStr(imagen.Width)

Error = gflChangeColorDepth(imagen, ptri, GFL_MODE_TO_RGB, GFL_MODE_NO_DITHER)

extGetGflBitmapFromPtr ptri, ima

parametros.FormatIndex = gflGetFormatIndexByName("jpeg")
parametros.Quality = 100
parametros.Progressive = False
parametros.OptimizeHuffmanTable = False
parametros.ChannelOrder = GFL_CTYPE_RGB

Error = gflSaveBitmap("c:\qw.jpg", ima, parametros)
MsgBox CStr(Error) ' Here show me 10

thanks for your help.
Do you use gflGetDefaultLoadParams?
Pierre
Rmgarcia

gflGetDefaultLoadParams

Post by Rmgarcia »

But I don´t load any image, I only copy from clipboard. Or I must use gflGetDefaultLoadParams?, How?...

Thanks a lot .

Rafael Martínez García.
User avatar
xnview
Author of XnView
Posts: 43897
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: gflGetDefaultLoadParams

Post by xnview »

Rmgarcia wrote:But I don´t load any image, I only copy from clipboard. Or I must use gflGetDefaultLoadParams?, How?...
Sorry gflGetDefaultSaveParams before gflSaveBitmap
Pierre.
Rmgarcia

gflGetDefaultSaveParams

Post by Rmgarcia »

I try gflGetDefaultSaveParams with variable parametros and I get the same error 10. I don't understand nothing. what's happen?.


Thank yoy very much.

Code: Select all

Dim imagen As GFL_BITMAP
Dim ima As GFL_BITMAP
Dim ptrimagen, ptri As Long
Dim Error As Integer
Dim hoja, diapo, forma, q As Object
Dim ancho, alto As Variant
Dim parametros As GFL_SAVE_PARAMS
Dim Handle As Long

Error = gflImportFromClipboard(ptrimagen)

        extGetGflBitmapFromPtr ptrimagen, imagen
        
        
        Error = gflChangeColorDepth(imagen, ptri, GFL_MODE_TO_RGB, GFL_MODE_NO_DITHER)
        extGetGflBitmapFromPtr ptri, ima

        gflGetDefaultSaveParams parametros
        
         parametros.FormatIndex = gflGetFormatIndexByName("jpeg")
        parametros.Quality = 100
        parametros.Progressive = False
        parametros.OptimizeHuffmanTable = False
        parametros.ChannelOrder = GFL_CTYPE_RGB
        
        Error = gflSaveBitmap("c:\qw.jpg", ima, parametros)
       MsgBox CStr(Error)
User avatar
xnview
Author of XnView
Posts: 43897
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: gflGetDefaultSaveParams

Post by xnview »

Could you try:
Rmgarcia wrote:

Code: Select all

        Error = gflChangeColorDepth(imagen, 0, GFL_MODE_TO_RGB, GFL_MODE_NO_DITHER)

        gflGetDefaultSaveParams parametros
        
         parametros.FormatIndex = gflGetFormatIndexByName("jpeg")
        parametros.Quality = 100
        parametros.Progressive = False
        parametros.OptimizeHuffmanTable = False
        parametros.ChannelOrder = GFL_CTYPE_RGB
        
        Error = gflSaveBitmap("c:\qw.jpg", imagen, parametros)
       MsgBox CStr(Error)
Pierre.