Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Images/JPEG/JPEG Benchmark
Function:
Required plugins for this example: MBS Images Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Images/JPEG/JPEG Benchmark
This example is the version from Sun, 17th Mar 2012.
Project "JPEG Benchmark.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Listbox1 Inherits Listbox
ControlInstance Listbox1 Inherits Listbox
End Control
EventHandler Sub Open() #pragma DisableBackgroundTasks // trigger license dialogs dim ji as new JPEGImporterMBS dim je as new JPEGexporterMBS // 3 different ways to scale images down from 6000 pixels to 400 pixels // all three use same scaling method // test image dim f as FolderItem = SpecialFolder.Desktop.Child("test.jpg") // try with pure RB dim t as Double = Microseconds for i as integer = 1 to 3 dim p as Picture = Picture.Open(f) p = scale(p) p.Save(SpecialFolder.Desktop.Child("testrb.jpg"), p.SaveAsJPEG, 80) next t = Microseconds - t Listbox1.AddRow str(t/3000,"0.0")+"ms with pure RB" // same with plugin t = Microseconds for i as integer = 1 to 3 dim p as Picture = f.OpenAsJPEGMBS p = scale(p) call SpecialFolder.Desktop.Child("testmbs1.jpg").SaveAsJPEGMBS(p, 80) next t = Microseconds - t Listbox1.AddRow str(t/3000,"0.0")+"ms with MBS" // and now with ScaleFactor t = Microseconds for i as integer = 1 to 3 dim j as new JPEGImporterMBS j.YieldTicks = 0 j.file = f j.ScaleFactor = 8 j.Import dim p as Picture = j.Picture p = scale(p) call SpecialFolder.Desktop.Child("testmbs2.jpg").SaveAsJPEGMBS(p, 80) next t = Microseconds - t Listbox1.AddRow str(t/3000,"0.0")+"ms with MBS and scalefactor" End EventHandler
Function Scale(p as Picture) As Picture dim q as new Picture(400, 300, 32) q.Graphics.DrawPicture p, 0, 0, q.Width, q.Height, 0, 0, p.Width, p.Height Return q End Function
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Images Plugin.




Links
MBS FileMaker tutorial videos