; Module/File: Image_GetSizePix.pb ; Function: Get the pixel size of an image - Linux ; Author: Omi ; Date: Feb. 24, 2018 ; Version: 0.1 ; Target Compiler: PureBasic 5.22/5.31/5.4/5.6 ; Target OS: Linux: (X/K/L)ubuntu, Mint, 32/64, Ascii/Uni ;-------------------------------------------------------------- EnableExplicit Global.i gProgramId Global.s gOutput Global.s gYourImageFile= "/usr/share/icons/gnome/256x256/actions/system-shutdown.png"; set an existing file ;small one: gOutput= "" gProgramId = RunProgram("identify", "-format " + #DQUOTE$ + "%w;%h" + #DQUOTE$ + gYourImageFile, "", #PB_Program_Open | #PB_Program_Read) If gProgramId While ProgramRunning(gProgramId) If AvailableProgramOutput(gProgramId) gOutput + ReadProgramString(gProgramId) + #LF$ EndIf Wend EndIf Debug gOutput ;bigger one: gOutput= "" gProgramId = RunProgram("identify", "-format " + #DQUOTE$ + "%t: %w x %h in %z Bit" + #DQUOTE$ + gYourImageFile, "", #PB_Program_Open | #PB_Program_Read) If gProgramId While ProgramRunning(gProgramId) If AvailableProgramOutput(gProgramId) gOutput + ReadProgramString(gProgramId) + #LF$ EndIf Wend EndIf Debug "Size of " + gOutput ; IDE Options = PureBasic 5.70 LTS beta 2 (Linux - x64) ; CursorPosition = 15 ; EnableXP ; EnableUnicode