How to force using JPEG compression for BMP, PNG, TIFF images in SWF Scout SDK

Submitted by eLenka on 6 July, 2011 - 15:35

Check out the sample of forcing JPEG compression for images of other formats used in Flash movie (SWF) generated with SWF Scout SDK.

Using JPEG compression for BMP, PNG, TIFF images in SWF movie can reduce file size up to 5-7 times. 

Generated flash movie:

VB Source Code:

W = 640 ' width
 H = 480 ' height
 Set Movie = CreateObject("SWFScout.FlashMovie")
 Movie.InitLibrary "demo","demo"
 Movie.BeginMovie 0,0,W,H,1,12,6
 Image = Movie.AddImageFromFileName("24.bmp")
 Movie.IMAGE_ConvertToJPEG 75
 Movie.PlaceImage Image, Movie.CurrentMaxDepth
 
Font = Movie.AddFont( "Arial",12,true,false,false,false,0)
 Text = Movie.AddText2 ("Source 24.bmp=350KB, Final .swf=17KB",0,0,0,255,Font, W / 2, 60,2)
 Movie.PlaceText Text,Movie.CurrentMaxDepth ' place text

Movie.ShowFrame 1
 Movie.EndMovie
 
Movie.SaveToFile "ForcedJPEGCompression.swf"

 

Download source code: