This is the code we used
//Method: dev_convertPicLibToJPEG
//Description
//convert picture library pictures to JPEG for upgrade to v16 - set
transparent background
// Parameters
// ----------------------------------------------------
If (User in group(Current user;"Design Access Group"))
ARRAY LONGINT($picRefs_aL;0)
ARRAY TEXT($PicNames_atxt;0)
PICTURE LIBRARY LIST($picRefs_aL;$PicNames_atxt)
C_LONGINT($loop_L)
C_PICTURE($pic_pic)
If (hmFree_IsLicensed >=0)
Else
$loop_L:=hmFree_Register ("rLhAA-YcUAGWAAAAJCAMoBksABRAD+AGtAJbF-+")
End if
C_TEXT($CurrFolder_txt;$msg_txt)
$CurrFolder_txt:=""
If (Application type=4D Remote mode)
$CurrFolder_txt:=System folder(Documents folder)+Structure file+"PictLibrary:"
Else
$CurrFolder_txt:=GetPath (Structure file)+"PictLibrary:"
End if
If (Test path name($CurrFolder_txt)=Is a folder)
Else
CREATE FOLDER($CurrFolder_txt)
End if
C_BLOB($picBlob_x)
CONFIRM("Reload picture library from "+$CurrFolder_txt+"
folder?";"Reload";"LeaveAsIs")
If (OK=1)
For ($loop_L;1;Size of array($picRefs_aL))
If (Test path
name($CurrFolder_txt+String($picRefs_aL{$loop_L};"0000000000")+".4pct")=Is a
document)
DOCUMENT TO
BLOB($CurrFolder_txt+String($picRefs_aL{$loop_L};"0000000000")+".4pct";$picBlob_x)
BLOB TO VARIABLE($picBlob_x;$pic_pic)
SET PICTURE TO LIBRARY($pic_pic;$picRefs_aL{$loop_L};$PicNames_atxt{$loop_L})
End if
End for
End if
For ($loop_L;1;Size of array($picRefs_aL))
ARRAY TEXT($TypesFound_atxt;0)
GET PICTURE FROM LIBRARY($picRefs_aL{$loop_L};$pic_pic)
hmFree_GET PICTURE TYPES ($pic_pic;$TypesFound_atxt)
If (Size of array($TypesFound_atxt)>0)
If ($TypesFound_atxt{1}="@pict@")
//convert to png
$msg_txt:=$msg_txt+"Change pic
"+String($picRefs_aL{$loop_L})+"/"+$PicNames_atxt{$loop_L}+" from size
"+String(Picture size($pic_pic))
VARIABLE TO BLOB($pic_pic;$picBlob_x)
BLOB TO
DOCUMENT($CurrFolder_txt+String($picRefs_aL{$loop_L};"0000000000")+".4pct";$picBlob_x)
CONVERT PICTURE($pic_pic;"image/png")
TRANSFORM PICTURE($pic_pic;Transparency;0x00FFFFFF)
$msg_txt:=$msg_txt+" to new png size "+String(Picture
size($pic_pic))+Char(Carriage return)
SET PICTURE TO LIBRARY($pic_pic;$picRefs_aL{$loop_L};$PicNames_atxt{$loop_L})
Else
$msg_txt:=$msg_txt+"pic
"+String($picRefs_aL{$loop_L})+"/"+$PicNames_atxt{$loop_L}+" is type
"+$TypesFound_atxt{1}+Char(Carriage return)
End if
End if
End for
ut_BigAlert ($msg_txt;"Messages")
If (False)
ARRAY LONGINT($picrefs_aL;0)
ARRAY TEXT($picNames_atxt;0)
PICTURE LIBRARY LIST($picrefs_aL;$picNames_atxt)
C_PICTURE($libpict)
ARRAY LONGINT($pictomod_aL;0)
APPEND TO ARRAY($pictomod_aL;6657)
APPEND TO ARRAY($pictomod_aL;6671)
APPEND TO ARRAY($pictomod_aL;6669)
APPEND TO ARRAY($pictomod_aL;6660)
APPEND TO ARRAY($pictomod_aL;10065)
APPEND TO ARRAY($pictomod_aL;6662)
APPEND TO ARRAY($pictomod_aL;10383)
APPEND TO ARRAY($pictomod_aL;10396)
C_LONGINT($loop_L;$indx_L)
C_TEXT($msg_txt)
For ($loop_L;1;Size of array($pictomod_aL))
$indx_L:=Find in array($picrefs_aL;$pictomod_aL{$loop_L})
GET PICTURE FROM LIBRARY($pictomod_aL{$loop_L};$libpict)
$msg_txt:="Change pic
"+String($pictomod_aL{$loop_L})+"/"+$picNames_atxt{$indx_L}+" from size
"+String(Picture size($libpict))
CONVERT PICTURE($libpict;"image/jpeg")
$msg_txt:=$msg_txt+" to new jpeg size "+String(Picture size($libpict))
SET PICTURE TO LIBRARY($libpict;$pictomod_aL{$loop_L};$picNames_atxt{$indx_L})
ALERT($msg_txt)
End for
End if
End if
//End dev_convertPicLibToJPEG
------------------------------------------------------------------------------------------------
Chuck Miller Voice: (617) 739-0306
Informed Solutions, Inc. Fax: (617) 232-1064
mailto:cjmiller<AT SIGN>informed-solutions.com
Brookline, MA 02446 USA Registered 4D Developer
Providers of 4D and Sybase connectivity
http://www.informed-solutions.com
------------------------------------------------------------------------------------------------
This message and any attached documents contain information which may be
confidential, subject to privilege or exempt from disclosure under applicable
law. These materials are intended only for the use of the intended recipient.
If you are not the intended recipient of this transmission, you are hereby
notified that any distribution, disclosure, printing, copying, storage,
modification or the taking of any action in reliance upon this transmission is
strictly prohibited. Delivery of this message to any person other than the
intended recipient shall not compromise or waive such confidentiality,
privilege or exemption from disclosure as to this communication.
> On May 9, 2018, at 1:23 PM, Alan Tilson via 4D_Tech <[email protected]>
> wrote:
>
> PICTURE LIBRARY LIST(arPicRefs;arPicNames)
> For ($el;1;Size of array(arPicRefs))
> $picRef:=arPicRefs{$el}
> $picName:=arPicNames{$el}
> GET PICTURE FROM LIBRARY($picRef;$picture)
> GET PICTURE FORMATS($picture;$arCodecIDs)
> If ($arCodecIDs{1}=".pict")
> CONVERT PICTURE($picture;".png")
> TRANSFORM PICTURE($picture;Transparency;"0x00FFFFFF")
> SET PICTURE TO LIBRARY($picture;$picRef;$picName)
> End if
> End for
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************