Platforms to show: All Mac Windows Linux Cross-Platform
/Images/JPEG/SaveJPEG without QuickTime
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/SaveJPEG without QuickTime
This example is the version from Mon, 5th May 2019.
Project "SaveJPEG without QuickTime.xojo_binary_project"
Class Window1 Inherits Window
Control preview Inherits Canvas
ControlInstance preview Inherits Canvas
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect)
g.drawpicture current,0,0
End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control Quality Inherits Slider
ControlInstance Quality Inherits Slider
EventHandler Sub ValueChanged()
value.text=str(me.value)
run
preview.Invalidate
End EventHandler
End Control
Control value Inherits Label
ControlInstance value Inherits Label
End Control
Control size Inherits Label
ControlInstance size Inherits Label
End Control
EventHandler Sub Open()
create
run
End EventHandler
Sub create()
dim g as graphics
dim x as integer
dim y as integer
dim r as RGBSurface
dim w as integer
dim h as integer
original = new Picture(preview.width,preview.height,32)
r=original.RGBSurface
g=original.graphics
w=original.width-1
h=original.height-1
for x=0 to w
for y=0 to h
r.pixel(x,y)=rgb(x*255/w,y*255/h,y*255/h)
next
next
End Sub
Sub run()
dim f as folderItem
f=SpecialFolder.Desktop.child("test.jpg")
if f.SaveAsJPEGMBS(original,quality.value) then
current=f.OpenAsJPEGMBS(true)
size.text=str(f.length)+" Bytes"
else
msgBox "Error on creating the JPEG file."
end if
End Sub
Property current As picture
Property original As picture
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project
See also:
The items on this page are in the following plugins: MBS Images Plugin.