Differenze tra le versioni di "Ottenere alcune informazioni su file immagine GIF con le funzioni del API di GifLib"

Da Gambas-it.org - Wikipedia.
Riga 54: Riga 54:
  
 
=Riferimenti=
 
=Riferimenti=
* [http://giflib.sourceforge.net/gif_lib.html The GIFLIB Library]
+
* http://giflib.sourceforge.net/gif_lib.html
* [http://wwwcdf.pd.infn.it/libgif/index.html Introduction to GIFLIB]
+
* http://wwwcdf.pd.infn.it/libgif/index.html
 +
* http://fossies.org/dox/giflib-5.1.1/index.html

Versione delle 16:20, 30 nov 2015

La libreria GifLib, scritta da Eric Steven Raymond, consente di leggere e scrivere file immagine in formato GIF.


E' possibile ottenere anche alcune informazioni generali su un'immagine GIF.

Per poter utilizzare le risorse della libreria GifLib, utilizzeremo la libreria: libgif.so.4.1.6


Mostriamo un semplice esempio:

' GifFileType *DGifOpenFileHandle(int GifFileHandle)
' Update a New GIF file, given its file handle.
Private Extern DGifOpenFileHandle(FileHandle As Integer) As Pointer In "libgif:4.1.6"


Public Sub Main()

 Dim GifFile1, GifFile2 As Pointer
 Dim fl As File
 Dim percorso As String = "/percorso/del/file.gif"
 Dim i As Integer
 Dim st As Stream
 
  fl = Open percorso For Read
    
  GifFile1 = DGifOpenFileHandle(fl.Handle)
  If IsNull(GifFile1) Then Print "Impossibile ottenere il descrittore dell'immagine !"

  Print "== Dati generali dell'immagine ==\n"
  Print "File immagine: "; Null, percorso
  st = Memory GifFile1 For Read
  Read #st, i
  Print "Larghezza: "; Null, i; " pixel"
  Read #st, i
  Print "Altezza: "; Null, i; " pixel"
  Read #st, i
  Print "Risol. colore: "; Null, i
  Seek #st, 16
  Read #st, GifFile2
  st.Close

    st = Memory GifFile2 For Read
    Seek #st, 4
    Read #st, i
    Print "Bit per Pixel: "; Null, i; " bit"
   
' Va in chiusura:
  st.Close
  fl.Close

End



Riferimenti