Comme le lien du topic original est mort, je vous le réup.
Topic : http://www.purebasic.fr/english/viewtop ... 40&t=57656
Code exemple ICI
ENJOYEZ

Code : Tout sélectionner
RunProgram("C:\PureBasic\apngdis_gui.exe","c:\purebasic\elephant.png" ,#Null$,#PB_Program_Wait)
End
Code : Tout sélectionner
;DESASSEMBLAGE d'un FICHIER APNG
;test extract apng+
;récuperer l'élephant png de blendman
;http://apng.onevcat.com/demo/
;télécharger apngdis.exe ici : https://sourceforge.net/projects/apngdis/files/2.8/
chemin$ = "C:\PureBasic\"
image$ = "elephant.png"
; création du dossier travail : framelephant dans le repetoire C:\PureBasic
CreateDirectory(chemin$ + Left("Fram" + image$, Len(image$))) ; framelephant
file$ = chemin$ + Left("Fram" + image$, Len(image$)) + "\" + image$
file2$ = chemin$ + Left("Fram" + image$, Len(image$)) + "\"
CopyFile(chemin$ + image$, file$)
processID.l = RunProgram(chemin$ + "apngdis_gui.exe", file$, #Null$,#PB_Program_Open)
For i = 1 To 99 ; boucle de temporisation du desassemblage avant Kill process
If i < 10
compt$ = "0" + Str(i) + ".png"
Else
compt$ = Str(i) + ".png"
EndIf
Repeat
exit = 0
If ReadFile(0,file2$ + "apngframe" + compt$)
exit = 1
CloseFile(0)
num = 1
EndIf
If IsFile(0) : CloseFile(0) : EndIf
If num = 1 : u = u + 1 : EndIf
If u > 99 : exit = 1 : Break 2 : EndIf
Delay(i)
Until exit = 1
Next i
KillProgram(processID)
CloseProgram(processID)
End
;######################## DOCUMENTATION #############################"
; APNG Disassembler 2.8
;
; Deconstructs APNG files into individual frames.
;
; http://apngdis.sourceforge.net/
;
; Copyright (c) 2010-2015 Max Stepin
; maxst@users.sourceforge.net
;
; License: zlib license
;
; --------------------------------
;
; Usage:
;
; apngdis anim.png [name]
;
; --------------------------------
;
; Decoding is implemented by parsing all chunks in the APNG file,
; remuxing them into a sequence of Static PNG images, And then using
; regular (unpatched) libpng To decode them.
;
; Then, after processing blend/dispose operations, we get a vector of
; full-size frames in 32 bpp As the result.
;
;
;
; Other useful tools:
;
; APNG Assembler - http://apngasm.sourceforge.net/
; gif2apng converter - http://gif2apng.sourceforge.net/
Code : Tout sélectionner
;ASSEMBLAGE APNG
;télécharger apngasm.exe ici : https://sourceforge.net/projects/apngdis/files/2.8/
chemin$ = "C:\PureBasic\"
image$ = "elephant_new.png"
;repetoire source frame : framelephant
chemin2$ = "C:\PureBasic\framelephant\"
; ;#doc Exemple apngasm output.png frame01.png
RunProgram(chemin$ + "apngasm.exe" + " ", chemin2$+image$ + " " + chemin2$+"apngframe01.png", #Null$, #PB_Program_Read)
; ;RunProgram(chemin$ + "apngasm.exe" + " ", chemin2$+image$ + " " + chemin2$+"apngframe01.png", #Null$, #PB_Program_Read | #PB_Program_Hide)
; ;#doc Exemple 1 apngasm output.png frame01.png 3 4
; RunProgram(chemin$ + "apngasm.exe" + " ", chemin2$+image$ + " " + chemin2$+"apngframe01.png" + " 1 10", #Null$, #PB_Program_Read) ; | #PB_Program_Hide
; ;#doc Exemple 2 apngasm output.png frame00.png 3 4 /f
; RunProgram(chemin$ + "apngasm.exe" + " ", chemin2$+image$ + " " + chemin2$+"apngframe00.png" + " 3 4" + "/f", #Null$, #PB_Program_Read)
; " | #PB_Program_Hide"
;nom du fichier assemblé "elephant_new.png"
End
;######################## DOCUMENTATION #############################"
; APNG Assembler 2.3
;
; by Max Stepin
; maxst@users.sourceforge.net
; #---------------------------
; Creates APNG animation from PNG/TGA image sequence.
;
; Usage:
; apngasm output.png frame001.png [options]
; apngasm output.png frame*.png [options]
;
; Options :
; 1 10 : frame delay is 1/10 sec. (Default)
; /l2 : 2 loops (Default is 0, ForEver)
; /f : skip the first frame
; /kp : keep palette
; /kc : keep color type
;
; #----------------------------------------------------------------
; Example 1:
;
; Let's say you have following frame sequence:
; frame01.png
; frame02.png
; frame03.png
;
; And you want To have 3/4 seconds delay between frames.
; The correct command will be
;
; apngasm output.png frame01.png 3 4
;
; #----------------------------------------------------------------
; Example 2:
;
; The same As above, but you added "invisible" frame00.png :
; frame00.png - invisible
; frame01.png
; frame02.png
; frame03.png
;
; The correct command will be
;
; apngasm output.png frame00.png 3 4 /f
;
; That way APNG supported browsers And image viewers
; will show frame01-frame02-frame03 animation,
; While IE And Chrome will display Static frame00.png image.
;
; Some people like To put "your browser sucks" message in that
; frame00.png but keep in mind that you will see that message
; in thumbnails when you are browsing image folders,
; Or using google image search. So be careful.
;
; #----------------------------------------------------------------
; Example 3:
;
; apngasm output.png frame01.png
;
; That way you'll get 1/10 sec delay.
;
; #----------------------------------------------------------------
; Some optimizations used in APNG Assembler might re-sort the
; palette, Or change the color type from RGBA And RGB modes
; To RGB And indexed modes. Those optimizations are only performed
; when they are lossless, but If you want To avoid changing the
; palette Or colortype, use those switches To turn them off:
;
; /kp : keep palette
; /kc : keep color type
Code : Tout sélectionner
;Mode APNG2GIF
;récuperer l'image elephant png de blendman
;http://apng.onevcat.com/demo/
;URL du programme de conversion APNG2GIF : https://sourceforge.net/projects/apngdis/files/2.8/
chemin$ = "C:\PureBasic\"
image1$ = "elephant.png"
image2$ = "elephant.gif"
; création du dossier travail : Framelephant dans le repetoire C:\PureBasic
CreateDirectory(chemin$ + Left("Fram" + image1$, Len(image1$))) ; Framelephant
file1$ = chemin$ + Left("Fram" + image1$, Len(image1$)) + "\" + image1$
file2$ = chemin$ + Left("Fram" + image1$, Len(image1$)) + "\" + image2$
CopyFile( chemin$ + image1$, file1$)
; Options + " -t 128" + " -b #FF0000"
RunProgram(chemin$ + "apng2gif_gui.exe ", file1$ + " " + file2$ + " -t 128" + " -b 255 0 0" , #Null$, #PB_Program_Read)
End
;######################## DOCUMENTATION #############################"
; apng2gif version 1.7
;
; This program converts APNG animations into animated GIF format.
; Wu quantizer is used For true-color files.
;
; http://apng2gif.sourceforge.net/
;
; Copyright (c) 2010-2015 Max Stepin
; maxst@users.sourceforge.net
;
; License: zlib license
;
; --------------------------------
;
; Changes in version 1.7:
;
; - new APNG decoder based on apngdis 2.8
;
; --------------------------------
;
; Usage (For command-line version):
;
; apng2gif anim.png [anim.gif] [-t tlevel] [-b bcolor]
;
; Options:
;
; -t 128
;
; will set the transparency threshold level As 128, so pixels
; With alpha level less than 128 will become fully transparent.
;
; -b 255 0 0
; -b "#ff0000"
;
; will set the background color As red, so partially transparent
; pixels will be composed over red. When -b is used, -t is ignored.
;
; When no options are specified, Default threshold is 128,
; no background color.
Code : Tout sélectionner
;Mode GIF2APNG
;récuperer l'image elephant gif de blendman
;http://apng.onevcat.com/demo/
;URL du programme de conversion GIF2APNG : https://sourceforge.net/projects/apngdis/files/2.8/
chemin$ = "C:\PureBasic\"
image1$ = "elephant.gif"
image2$ = "elephant.png"
; création du dossier travail : Giffelephant dans le repetoire C:\PureBasic
CreateDirectory(chemin$ + Left("Giff" + image1$, Len(image1$))) ; Giffelephant
file1$ = chemin$ + Left("Giff" + image1$, Len(image1$)) + "\" + image1$
file2$ = chemin$ + Left("Giff" + image1$, Len(image1$)) + "\" + image2$
CopyFile( chemin$ + image1$, file1$)
; Options + " -7z" + " -i##" + " -kp"
RunProgram(chemin$+"gif2apng_gui.exe " , file1$ + " " + file2$ + " -7z" + " -i34" , #Null$, #PB_Program_Read)
End
;######################## DOCUMENTATION #############################"
; gif2apng version 1.9
;
; This program converts GIF animations into APNG format.
;
; http://gif2apng.sourceforge.net/
;
; Copyright (c) 2009-2013 Max Stepin
; maxst@users.sourceforge.net
;
; License: zlib license
;
; --------------------------------
;
; Changes in version 1.9:
;
; - Code cleanup, cosmetic changes.
;
;
; Changes in version 1.8:
;
; - Added 7zip And Zopfli compression options.
;
; --------------------------------
;
; Usage:
;
; gif2apng [options] anim.gif [anim.png]
;
; Options:
;
; -z0 : zlib compression
; -z1 : 7z compression (Default)
; -z2 : zopfli compression
; -i## : number of iterations, Default -i15
; -kp : keep the palette