KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Update picture format
PRODUCT: 4D | VERSION: 12.4 | PLATFORM: Mac OS X
Published On: December 13, 2012

You may encounter problems when deal with pictures in your database, especially when you are on Mac OS. Under Mac OS, 4D uses ImageIO. All the available ImageIO codecs are therefore natively supported for decoding (reading) as well as encoding (writing). There are certain formats that can only be written by 4D, but not be read by 4D, such as .pict format. If your database contains .pict files, you may get an error message when try to read those files. There are formats that can be both written and read by 4D, such as .jpg format. Please make sure the format you are using for your pictures are compatible with the picture codec of your system.

You can use following code to check all the picture formats that can be read by 4D.

PICTURE CODEC LIST(codecArray;namesArray)
C_TEXT(readList)
For($i;1;Size of array(namesArray))
  readList:=readList+namesArray{$i}+"; "
End for
ALERT("Formats that can be read are: "+"\n\n"+readList)


If you have problems with your pictures saved in your table, and found that is because of the format issue we talked above. You can always convert your picture to .jpg format by the code below:

FIRST RECORD([Table_1])
For ($i;1;Records in selection([Table_1]))
  CONVERT PICTURE([Table_1]Image;".jpg")
  SAVE RECORD([Table_1])
  NEXT RECORD([Table_1])
End for